From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#8613: "mode:" for minor-mode breaks set-visited-file-name Date: Wed, 04 May 2011 22:20:00 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1304562072 29769 80.91.229.12 (5 May 2011 02:21:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 5 May 2011 02:21:12 +0000 (UTC) Cc: 8613@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 05 04:21:08 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QHoBf-00015d-Kz for geb-bug-gnu-emacs@m.gmane.org; Thu, 05 May 2011 04:21:07 +0200 Original-Received: from localhost ([::1]:56745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHoBe-0001M3-Ue for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 May 2011 22:21:06 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:46943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHoBc-0001Ly-9Z for bug-gnu-emacs@gnu.org; Wed, 04 May 2011 22:21:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHoBb-0006Cz-Au for bug-gnu-emacs@gnu.org; Wed, 04 May 2011 22:21:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:32882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHoBb-0006Cu-5M for bug-gnu-emacs@gnu.org; Wed, 04 May 2011 22:21:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QHoBa-0000NZ-4P; Wed, 04 May 2011 22:21:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 May 2011 02:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8613 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8613-submit@debbugs.gnu.org id=B8613.13045620081384 (code B ref 8613); Thu, 05 May 2011 02:21:02 +0000 Original-Received: (at 8613) by debbugs.gnu.org; 5 May 2011 02:20:08 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QHoAi-0000MH-1F for submit@debbugs.gnu.org; Wed, 04 May 2011 22:20:08 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QHoAg-0000Lr-As for 8613@debbugs.gnu.org; Wed, 04 May 2011 22:20:07 -0400 Original-Received: from localhost ([127.0.0.1]:58707) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHoAb-00061b-27; Wed, 04 May 2011 22:20:01 -0400 X-Spook: EuroFed Operation Iraqi Freedom Ft. Meade USCODE X-Ran: pP<[$S9XK)9>5Vnbdk_?:62RIy-+vRWGG>[jPHo?WzQ(f/m[i>W:*i]4Ay4:[:~_o.'O++ X-Hue: green X-Attribution: GM User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 04 May 2011 22:21:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:46223 Archived-At: 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