From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: :EXPORT_FILE_NAME: in new exporter possible? Date: Mon, 25 Mar 2013 16:54:47 +0100 Message-ID: <87wqsvmq48.fsf@bzg.ath.cx> References: <87620kwyuj.fsf@ericabrahamsen.net> <87k3p073ba.fsf@med.uni-goettingen.de> <8738vo1go1.fsf@bzg.ath.cx> <878v5chvdj.fsf@bzg.ath.cx> <87620fo7bi.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:50010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK9jb-0006Z4-Hf for emacs-orgmode@gnu.org; Mon, 25 Mar 2013 11:54:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UK9jW-0003Af-3W for emacs-orgmode@gnu.org; Mon, 25 Mar 2013 11:54:55 -0400 Received: from mail-wg0-x22a.google.com ([2a00:1450:400c:c00::22a]:40280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK9jV-00038W-Ph for emacs-orgmode@gnu.org; Mon, 25 Mar 2013 11:54:50 -0400 Received: by mail-wg0-f42.google.com with SMTP id 12so4138493wgh.1 for ; Mon, 25 Mar 2013 08:54:48 -0700 (PDT) In-Reply-To: (Achim Gratz's message of "Mon, 25 Mar 2013 16:09:23 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Achim Gratz Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Achim Gratz writes: > As I said, I don't even know why Gnus decides it should treat this mail as > an Org file. From the sources of Gnus, it appears that it should only do > this if the MIME type was text/x-org. Rainers mail didn't have this MIME > type nor was it a multipart MIME mail that had such a part, yet Gnus > triggered the buffer with "Org" as the major mode, which seems to indicate > that the MIME type must somehow have been inferred. I can prevent that > using orgstruct-mode instead, but as I proposed already there should be a > "safe" variant of org-mode (a derived mode perhaps) that doesn't load any > axtra files and doesn't run any source blocks. Of course, Gnus then should > use this mode (it is only meant for proper fontification anyway, which I > suppose must be possible without firing a whole major mode). What about this patch? The change in Gnus is then trivial (see other patch). --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=org-read-setup-file-conditionnally.patch diff --git a/lisp/org.el b/lisp/org.el index 04a0f20..88f9ea0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1266,6 +1266,26 @@ smart Make point visible, and do insertion/deletion if it is (const :tag "Show invisible part and do the edit" show) (const :tag "Be smart and do the right thing" smart))) +(defcustom org-read-setup-file 'ask + "Should Org read setup files? +A setup file can be specified with the #+SETUPFILE keyword. +When reading someone else Org files, Emacs will try to read +arbitrary read an arbitrary file on your computer. + +The default is to ask users before reading a file. +Setting this option to 'if-interactive will read the setup +file when `org-mode' has been called interactively. +Setting this option to t will always read setup files." + :group 'org-startup + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "Never read a setup file" nil) + (const :tag "Ask before trying to read a setup file" 'ask) + (const :tag "Read a setup file when `org-mode' is called interactively" + 'if-interactive) + (const :tag "Always try to read a setup file" t))) + (defcustom org-yank-folded-subtrees t "Non-nil means when yanking subtrees, fold them. If the kill is a single subtree, or a sequence of subtrees, i.e. if @@ -4828,8 +4848,10 @@ Support for group tags is controlled by the option (assoc (car e) org-tag-alist)) (push e org-tag-alist)))))))) -(defun org-set-regexps-and-options () - "Precompute regular expressions used in the current buffer." +(defun org-set-regexps-and-options (&optional interactivep) + "Precompute regular expressions used in the current buffer. +If INTERACTIVEP is non-nil, `org-set-regexps-and-options' has +been called from an interactive call to `org-mode'." (when (derived-mode-p 'org-mode) (org-set-local 'org-todo-kwd-alist nil) (org-set-local 'org-todo-key-alist nil) @@ -4912,7 +4934,11 @@ Support for group tags is controlled by the option (setq scripts (read (match-string 2 value))))) ((and (equal key "SETUPFILE") ;; Prevent checking in Gnus messages - (not buffer-read-only)) + (or (and (eq org-read-setup-file 'if-interactive) interactivep) + (and (eq org-read-setup-file 'ask) + (yes-or-no-p (format "Read setup file %s? " value))) + (eq org-read-setup-file t) + (progn (message "Setup file %s not read" value) (sit-for 2)))) (setq setup-contents (org-file-contents (expand-file-name (org-remove-double-quotes value)) @@ -5272,7 +5298,7 @@ The following commands are available: (if (stringp org-ellipsis) org-ellipsis "...")))) (setq buffer-display-table org-display-table)) (org-set-regexps-and-options-for-tags) - (org-set-regexps-and-options) + (org-set-regexps-and-options (org-called-interactively-p 'any)) (when (and org-tag-faces (not org-tags-special-faces-re)) ;; tag faces set outside customize.... force initialization. (org-set-tag-faces 'org-tag-faces org-tag-faces)) @@ -20152,7 +20178,7 @@ This command does many different things, depending on context: "Restart Org-mode, to scan again for special lines. Also updates the keyword regular expressions." (interactive) - (org-mode) + (call-interactively 'org-mode) (message "Org-mode restarted")) (defun org-kill-note-or-show-branches () --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=mm-view.el.patch diff --git a/lisp/mm-view.el b/lisp/mm-view.el index ac6170a..690402c 100644 --- a/lisp/mm-view.el +++ b/lisp/mm-view.el @@ -647,7 +647,9 @@ If MODE is not set, try to find mode automatically." (defun mm-display-org-inline (handle) "Show an Org mode text from HANDLE inline." - (mm-display-inline-fontify handle 'org-mode)) + (mm-display-inline-fontify + handle + (lambda () (let (org-read-setup-file) (org-mode))))) (defun mm-display-shell-script-inline (handle) "Show a shell script from HANDLE inline." --=-=-= Content-Type: text/plain -- Bastien --=-=-=--