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: Mon, 09 May 2011 18:05:25 -0400 Message-ID: <3gk4dzo7h6.fsf@fencepost.gnu.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1304978779 18926 80.91.229.12 (9 May 2011 22:06:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 9 May 2011 22:06:19 +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 Tue May 10 00:06:14 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 1QJYad-00068s-RG for geb-bug-gnu-emacs@m.gmane.org; Tue, 10 May 2011 00:06:07 +0200 Original-Received: from localhost ([::1]:44593 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJYad-0003nk-1p for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 May 2011 18:06:07 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:44671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJYaa-0003nb-6w for bug-gnu-emacs@gnu.org; Mon, 09 May 2011 18:06:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJYaZ-0002gP-6V for bug-gnu-emacs@gnu.org; Mon, 09 May 2011 18:06:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJYaZ-0002gK-3d for bug-gnu-emacs@gnu.org; Mon, 09 May 2011 18:06:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QJYaY-0002yE-DS; Mon, 09 May 2011 18:06:02 -0400 X-Loop: help-debbugs@gnu.org 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: Mon, 09 May 2011 22:06: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.130497873311381 (code B ref 8613); Mon, 09 May 2011 22:06:02 +0000 Original-Received: (at 8613) by debbugs.gnu.org; 9 May 2011 22:05:33 +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 1QJYa4-0002xV-7s for submit@debbugs.gnu.org; Mon, 09 May 2011 18:05:32 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QJYa3-0002xL-49 for 8613@debbugs.gnu.org; Mon, 09 May 2011 18:05:31 -0400 Original-Received: from localhost ([127.0.0.1]:39198) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJYZx-0001oJ-R1; Mon, 09 May 2011 18:05:25 -0400 X-Spook: enforcers Arnett undercover red noise Aldergrove X-Ran: ~gVx4%uYdH~L42o'P&\%)~2_MM`TT~35ti9BvAz!)tG^1Ae&o-^Kp_l5.`TQ}(I?|Cy3[W X-Hue: green X-Attribution: GM In-Reply-To: (Stefan Monnier's message of "Thu, 05 May 2011 09:40:20 -0300") 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: Mon, 09 May 2011 18:06: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:46362 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. ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [...] > 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)))))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Does not compute. Anyway, that would work, tho' perhaps it could just be hard-coded in hack-one-local-variable-eval-safep, since the safety of mode: is not customizable at present, and having hooks with non-empty defaults is sub-optimal. > Hmm... that will affect the (push (nth 1 form) autoloads-done). > Not sure if it matters. FWIW, I checked loaddefs.el without and without this change, and saw only the expected differences. >> + :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. The only reason I could see needing :safe as an argument was if someone had some hypothetical minor-mode that for some reason was not safe. In which case, passing ":safe nil" seems like the simplest thing to me, rather than eg ":safe 'no", or inverting the whole thing to use :risky instead of :safe. But, there's no option to do this with mode:, so this is not needed to replace mode: for minor-modes.