From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Glenn Morris <rgm@gnu.org>
Cc: 8613@debbugs.gnu.org
Subject: bug#8613: "mode:" for minor-mode breaks set-visited-file-name
Date: Thu, 05 May 2011 09:40:20 -0300 [thread overview]
Message-ID: <jwvaaf15o0i.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <gt8vulvqgf.fsf@fencepost.gnu.org> (Glenn Morris's message of "Wed, 04 May 2011 22:20:00 -0400")
>> Not a bad idea, tho I'd much rather add
>> a (run-hook-with-args-until-success 'safe-local-eval-functions)
>> instead rather than rely on regexps.
> Regexps were the only way I could think of that did not require changes
> to the definition of each minor mode, however...
With a safe-local-eval-functions, you can do
(add-hook 'safe-local-eval-functions
(lambda (form)
(and (null (cdr form))
(symbolp (car form))
(string-match "-mode\\'" (symbol-name (car form))))))
>> Another option is to let define-minor-mode place
>> a `safe-local-eval-function' property on the minor-mode's symbol.
> ... that's nice and simple (I didn't know `safe-local-eval-function'
> existed); but I had to tweak make-autoload to get it to work right with
> autoloaded minor-modes (eg outline-minor).
> *** lisp/emacs-lisp/autoload.el 2011-05-04 15:38:41 +0000
> --- lisp/emacs-lisp/autoload.el 2011-05-05 02:14:30 +0000
> ***************
> *** 190,195 ****
> --- 190,197 ----
> (if (member ',file loads) nil
> (put ',groupname 'custom-loads (cons ',file loads))))))
>
> + ((eq car 'put) form)
> +
> ;; nil here indicates that this is not a special autoload form.
> (t nil))))
Hmm... that will affect the (push (nth 1 form) autoloads-done).
Not sure if it matters.
> *** lisp/emacs-lisp/easy-mmode.el 2011-01-25 04:08:28 +0000
> --- lisp/emacs-lisp/easy-mmode.el 2011-05-05 00:44:36 +0000
> ***************
> *** 115,120 ****
> --- 115,122 ----
> :lighter SPEC Same as the LIGHTER argument.
> :keymap MAP Same as the KEYMAP argument.
> :require SYM Same as in `defcustom'.
> + :safe PROP Set the MODE function's `safe-local-eval-function' property
> + to PROP (default t).
Not sure if we need it (currently all the -mode functions are presumed
safe when called without argument, as in the "mode:" cookie).
But if we do need it, it's better to reverse the meaning since we
should usually aim to make ":prop nil" behave the same as when
it's absent.
Stefan
next prev parent reply other threads:[~2011-05-05 12:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-03 23:00 bug#8613: "mode:" for minor-mode breaks set-visited-file-name Glenn Morris
2011-05-04 0:38 ` Stefan Monnier
2011-05-04 2:08 ` Glenn Morris
2011-05-04 12:52 ` Stefan Monnier
2011-05-05 2:20 ` Glenn Morris
2011-05-05 12:40 ` Stefan Monnier [this message]
2011-05-09 22:05 ` Glenn Morris
2011-05-09 22:44 ` Stefan Monnier
2011-05-09 23:41 ` Glenn Morris
2011-05-10 1:09 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvaaf15o0i.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=8613@debbugs.gnu.org \
--cc=rgm@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).