emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master dbe3e41: Don't try to eval local variables in Gnus article


From: Katsumi Yamaoka
Subject: Re: master dbe3e41: Don't try to eval local variables in Gnus article
Date: Tue, 20 Jun 2017 10:39:18 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (i686-pc-cygwin)

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:

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]