From: Glenn Morris <rgm@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 8613@debbugs.gnu.org
Subject: bug#8613: "mode:" for minor-mode breaks set-visited-file-name
Date: Wed, 04 May 2011 22:20:00 -0400 [thread overview]
Message-ID: <gt8vulvqgf.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <we4o5bxudd.fsf@fencepost.gnu.org>
Stefan Monnier wrote:
> 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...
> 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))))
*** 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).
:variable PLACE The location (as can be used with `setf') to use instead
of the variable MODE to store the state of the mode. PLACE
can also be of the form (GET . SET) where GET is an expression
***************
*** 156,161 ****
--- 158,164 ----
(setter nil) ;The function (if any) to set the mode var.
(modefun mode) ;The minor mode function name we're defining.
(require t)
+ (safe t)
(hook (intern (concat mode-name "-hook")))
(hook-on (intern (concat mode-name "-on-hook")))
(hook-off (intern (concat mode-name "-off-hook")))
***************
*** 174,179 ****
--- 177,183 ----
(:group (setq group (nconc group (list :group (pop body)))))
(:type (setq type (list :type (pop body))))
(:require (setq require (pop body)))
+ (:safe (setq safe (pop body)))
(:keymap (setq keymap (pop body)))
(:variable (setq variable (pop body))
(if (not (functionp (cdr-safe variable)))
***************
*** 264,269 ****
--- 268,275 ----
;; Return the new setting.
,mode)
+ (put ',modefun 'safe-local-eval-function ,safe)
+
;; Autoloading a define-minor-mode autoloads everything
;; up-to-here.
:autoload-end
next prev parent reply other threads:[~2011-05-05 2:20 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 [this message]
2011-05-05 12:40 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=gt8vulvqgf.fsf@fencepost.gnu.org \
--to=rgm@gnu.org \
--cc=8613@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.