unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master dbe3e41: Don't try to eval local variables in Gnus article
       [not found] ` <20170619021044.B8B5820DE6@vcs0.savannah.gnu.org>
@ 2017-06-19 20:15   ` Glenn Morris
  2017-06-19 23:40     ` Katsumi Yamaoka
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2017-06-19 20:15 UTC (permalink / raw)
  To: emacs-devel; +Cc: Katsumi Yamaoka

Katsumi Yamaoka wrote:

> branch: master
> commit dbe3e416af5d845dc774341eb66971ab1a72983b
[...]
> diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
> index dd64bfe..4276f9e 100644
> --- a/lisp/gnus/mm-view.el
> +++ b/lisp/gnus/mm-view.el
> @@ -488,7 +488,8 @@ If MODE is not set, try to find mode automatically."
>  		(funcall mode))
>  	    (let ((auto-mode-alist
>  		   (delq (rassq 'doc-view-mode-maybe auto-mode-alist)
> -			 (copy-sequence auto-mode-alist))))
> +			 (copy-sequence auto-mode-alist)))
> +		  (local-enable-local-variables nil))

Hi - local-enable-local-variables, as opposed to enable-local-variables,
is seldom used. Do you really need the former here? I see
mm-display-inline-fontify already binds enable-local-variables to nil.
See comments at definition of local-enable-local-variables in files.el.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: master dbe3e41: Don't try to eval local variables in Gnus article
  2017-06-19 20:15   ` master dbe3e41: Don't try to eval local variables in Gnus article Glenn Morris
@ 2017-06-19 23:40     ` Katsumi Yamaoka
  2017-06-20  1:39       ` Katsumi Yamaoka
  0 siblings, 1 reply; 4+ messages in thread
From: Katsumi Yamaoka @ 2017-06-19 23:40 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

On Mon, 19 Jun 2017 16:15:02 -0400, Glenn Morris wrote:
> Katsumi Yamaoka wrote:

>> branch: master
>> commit dbe3e416af5d845dc774341eb66971ab1a72983b
> [...]
>> diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
>> index dd64bfe..4276f9e 100644
>> --- a/lisp/gnus/mm-view.el
>> +++ b/lisp/gnus/mm-view.el
>> @@ -488,7 +488,8 @@ If MODE is not set, try to find mode automatically."
>>  		(funcall mode))
>>  	    (let ((auto-mode-alist
>>  		   (delq (rassq 'doc-view-mode-maybe auto-mode-alist)
>> -			 (copy-sequence auto-mode-alist))))
>> +			 (copy-sequence auto-mode-alist)))
>> +		  (local-enable-local-variables nil))

> Hi - local-enable-local-variables, as opposed to enable-local-variables,
> is seldom used. Do you really need the former here?

Yes, binding enable-local-variables did have no effect.  Instead,
I found these two options

(let ((inhibit-local-variables-regexps '(""))) ...)
(let ((local-enable-local-variables nil)) ...)

to inhibit set-auto-mode from trying to evaluate local variables
in the article <84r2ykc9fa.fsf@gmail.com> that can be found as
bug#27391 in the bug-gnu-emacs list, or:
<http://lists.gnu.org/archive/html/bug-gnu-emacs/2017-06/msg00519.html>

> I see
> mm-display-inline-fontify already binds enable-local-variables to nil.

Oh, I overlooked it!  I should rearrange them anyway.

> See comments at definition of local-enable-local-variables in files.el.

I did read it, but I haven't investigated why binding
enable-local-variables to nil is not effective thoroughly.  I'll
do it.

Thanks.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: master dbe3e41: Don't try to eval local variables in Gnus article
  2017-06-19 23:40     ` Katsumi Yamaoka
@ 2017-06-20  1:39       ` Katsumi Yamaoka
  2017-06-20  2:18         ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Katsumi Yamaoka @ 2017-06-20  1:39 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

On Tue, 20 Jun 2017 08:40:38 +0900, Katsumi Yamaoka wrote:
> , but I haven't investigated why binding enable-local-variables
> to nil is not effective thoroughly.  I'll do it.

What tries to eval local variables is `run-mode-hooks', that runs
in the buffer containing the CONTRIBUTING.md contents.

,---- a Lisp backtrace
| hack-local-variables-confirm(((eval message "Coucou"))\
| 	((eval message "Coucou")) nil nil)
| hack-local-variables-filter(((eval message "Coucou")) nil)
| hack-local-variables(no-mode)
| run-mode-hooks()
| fundamental-mode()
| set-buffer-major-mode(#<buffer  *temp*>)
| set-auto-mode()
| mm-display-inline-fontify((#<buffer  *mm*-519429>\
| 	("text/plain" (charset . "iso-8859-1"))\
| 	quoted-printable nil\
| 	("inline" (filename . "CONTRIBUTING.md"))\
| 	nil nil nil))
`----

Why binding `enable-local-variables' to nil is not effective is
that `fundamental-mode' runs `kill-all-local-variables':

(defun fundamental-mode ()
  "Major mode not specialized for anything in particular.
Other major modes are defined by comparison with this one."
  (interactive)
  (kill-all-local-variables)
  (run-mode-hooks))

It kills `enable-local-variables' which `mm-display-inline-fontify'
makes buffer-local.  So the right solution would be to bind it
globally:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 719 bytes --]

--- mm-view.el~	2017-06-19 02:09:32.424422200 +0000
+++ mm-view.el	2017-06-20 01:37:22.963901000 +0000
@@ -477,3 +477,4 @@
       (let ((font-lock-verbose nil)
-	    (font-lock-support-mode nil))
+	    (font-lock-support-mode nil)
+	    (enable-local-variables nil))
 	;; Disable support modes, e.g., jit-lock, lazy-lock, etc.
@@ -482,3 +483,2 @@
         (setq buffer-file-name (mm-handle-filename handle))
-        (set (make-local-variable 'enable-local-variables) nil)
 	(with-demoted-errors
@@ -490,4 +490,3 @@
 		   (delq (rassq 'doc-view-mode-maybe auto-mode-alist)
-			 (copy-sequence auto-mode-alist)))
-		  (local-enable-local-variables nil))
+			 (copy-sequence auto-mode-alist))))
 	      (set-auto-mode)))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: master dbe3e41: Don't try to eval local variables in Gnus article
  2017-06-20  1:39       ` Katsumi Yamaoka
@ 2017-06-20  2:18         ` Glenn Morris
  0 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2017-06-20  2:18 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: emacs-devel


Sounds right, thanks.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-20  2:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170619021043.362.89296@vcs0.savannah.gnu.org>
     [not found] ` <20170619021044.B8B5820DE6@vcs0.savannah.gnu.org>
2017-06-19 20:15   ` master dbe3e41: Don't try to eval local variables in Gnus article Glenn Morris
2017-06-19 23:40     ` Katsumi Yamaoka
2017-06-20  1:39       ` Katsumi Yamaoka
2017-06-20  2:18         ` Glenn Morris

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).