[Peter S Galbraith]
> Strangely, the following does eval in Emacs-21 :
> (defun header-regexpify (str)
> "Escape the characters *+-\^$ in STR. Return the new string."
> (let ((start 0)
> (ret "")
> match prev)
> (while (setq match (string-match "[*+\\-\\\\^$]" str start))
> (setq prev start
> start (match-end 0)
> ret (concat ret (substring str prev match) "\\"
> (substring str (match-beginning 0) start))))
> (concat ret (substring str start))))
-> Invalid modifier in string
My bad. Using XEmacs myself. Forgot to escape the \-character in the
docstring. Changing to:
"Escape the characters *+-\\^$ in STR. Return the new string."
should hopefully work fine.
>>> 2- Shouldn't this be a minor-mode ? That would avoid the global
>>> keymap bindings and would reduce the autoload cookies to only the
>>> minor-mode command.
>>
>> Yeah. I don't know. I guess it depends on the usage scenario. Do
>> you suggest that you first enable the minor mode before invoking
>> the command to insert file or function headers?
> That's what I thought. Someone how uses it a lot on certain file
> types would probably invoke it within a hook.
Perhaps so. But I use it in pretty much everything, so I'd have to
invoke it in tons of hooks (or alternatively just in find-file-hooks).
But then you also clutter the modeline with yet another minor mode
thing. Well, I guess it all boils down to your preferences. If there
exist some convention, though, I'm not objecting very much to
following it.
>> And how about automatic updates when saving the buffer? How does
>> that play along with minor modes? I honestly don't know/can't
>> remember.
> I haven't realy done anything more than quickly try the code, so I'm
> not familiar enough to know how it updates files it handles. I'll
> try to use it a bit (unless you have an example case to describe).
It updates, e.g., copyright strings or modification times. If you
always have the minor mode enabled while editing then I guess this
wouldn't be much of an issue.
eSk
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]