|
From: | Oleksandr Gavenko |
Subject: | Re: distinguish .h files |
Date: | Thu, 21 Oct 2010 16:31:52 +0300 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.11) Gecko/20101013 Thunderbird/3.1.5 |
On 21.10.2010 15:56, Andrea Crotti wrote:
Oleksandr Gavenko<gavenko@bifit.com.ua> writes:I don't know exactly,... --8<---------------cut here---------------start------------->8--- (defun c++-header-file-p () "Return non-nil, if in a C++ header." (and (string-match "\\.h$" (or (buffer-file-name) (buffer-name))) (save-excursion (re-search-forward "\\_<class\\_>" nil t)))) (add-to-list 'magic-mode-alist '(c++-header-file-p . c++-mode)) --8<---------------cut here---------------end--------------->8---I use your code to get this value (add this after 'string-match'): (message "%s" (- (point-max) (point-min))) I get 4000.I don't get your point... What's that useful for exactly?
Suppose header firstly have a lot of '#define', so 'class' keyword far from 'magic-mode-alist'. And .h file was opened in c-mode. I look ALT/MFS headers (not all). Usually 'class' matches near offset in 900 bytes.
[Prev in Thread] | Current Thread | [Next in Thread] |