From ab5e3729266b65182ca73fdd69eb9f29f870b17a Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 20 Dec 2012 15:34:10 +0100 Subject: [PATCH 1/3] org-agenda.el (org-agenda-finalize): Fix links activation * org-agenda.el (org-agenda-finalize): Fix links activation. --- lisp/org-agenda.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 522aa191d..68be0fef8 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3514,12 +3514,14 @@ generating a new one." (save-excursion (let ((inhibit-read-only t)) (goto-char (point-min)) - (while (org-activate-bracket-links (point-max)) - (add-text-properties (match-beginning 0) (match-end 0) - '(face org-link))) - (while (org-activate-plain-links (point-max)) - (add-text-properties (match-beginning 0) (match-end 0) - '(face org-link))) + (save-excursion + (while (org-activate-bracket-links (point-max)) + (add-text-properties (match-beginning 0) (match-end 0) + '(face org-link)))) + (save-excursion + (while (org-activate-plain-links (point-max)) + (add-text-properties (match-beginning 0) (match-end 0) + '(face org-link)))) (org-agenda-align-tags) (unless org-agenda-with-colors (remove-text-properties (point-min) (point-max) '(face nil)))) From f983cf172939c1885e4808fe695785eb7dd763d6 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 20 Dec 2012 15:42:53 +0100 Subject: [PATCH 2/3] org.el (org-set-font-lock-defaults): Don't activate links in source code blocks and fixed-width regions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * org.el (org-set-font-lock-defaults): Don't activate links in source code blocks and fixed-width regions. Thanks to Sébastien Vauban for reporting an error related to this. --- lisp/org.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 23b72c864..000079830 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5753,13 +5753,14 @@ needs to be inserted at a specific position in the font-lock sequence.") '(1 'org-special-keyword t) '(3 'org-property-value t)) ;; Links - (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend))) - (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t))) - (if (memq 'plain lk) '(org-activate-plain-links)) - (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t))) - (if (memq 'radio lk) '(org-activate-target-links (0 'org-link t))) - (if (memq 'date lk) '(org-activate-dates (0 'org-date t))) - (if (memq 'footnote lk) '(org-activate-footnote-links)) + (unless (or (org-in-src-block-p t) (org-in-fixed-width-region-p)) + (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend))) + (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t))) + (if (memq 'plain lk) '(org-activate-plain-links)) + (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t))) + (if (memq 'radio lk) '(org-activate-target-links (0 'org-link t))) + (if (memq 'date lk) '(org-activate-dates (0 'org-date t))) + (if (memq 'footnote lk) '(org-activate-footnote-links))) '("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t)) '(org-hide-wide-columns (0 nil append)) ;; TODO keyword From 27bcf9a70b1137c88cf856719ab6fd74297286ef Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 20 Dec 2012 15:49:19 +0100 Subject: [PATCH 3/3] Backport revno 111277 from Emacs trunk. * ob.el (org-babel-temp-file): Fix setting of `temporary-file-directory' on remote hosts. * ob-eval.el (org-babel-shell-command-on-region): Use `process-file' instead of `call-process-region'. The latter one does not work on remote hosts. --- lisp/ob-eval.el | 54 ++++++++++++++++++++++++++----------------------- lisp/ob.el | 14 +++++-------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lisp/ob-eval.el b/lisp/ob-eval.el index ddad067a5..5489c0806 100644 --- a/lisp/ob-eval.el +++ b/lisp/ob-eval.el @@ -134,14 +134,13 @@ specifies the value of ERROR-BUFFER." current-prefix-arg shell-command-default-error-buffer t))) - (let ((error-file - (if error-buffer - (make-temp-file - (expand-file-name "scor" - (if (featurep 'xemacs) - (temp-directory) - temporary-file-directory))) - nil)) + (let ((input-file (org-babel-temp-file "input-")) + (error-file (if error-buffer (org-babel-temp-file "scor-") nil)) + (shell-file-name + (if (file-executable-p + (concat (file-remote-p default-directory) shell-file-name)) + shell-file-name + "/bin/sh")) exit-status) (if (or replace (and output-buffer @@ -151,12 +150,14 @@ specifies the value of ERROR-BUFFER." ;; Don't muck with mark unless REPLACE says we should. (goto-char start) (and replace (push-mark (point) 'nomsg)) + (write-region start end input-file) + (delete-region start end) (setq exit-status - (call-process-region start end shell-file-name t - (if error-file - (list output-buffer error-file) - t) - nil shell-command-switch command)) + (process-file shell-file-name input-file + (if error-file + (list output-buffer error-file) + t) + nil shell-command-switch command)) ;; It is rude to delete a buffer which the command is not using. ;; (let ((shell-buffer (get-buffer "*Shell Command Output*"))) ;; (and shell-buffer (not (eq shell-buffer (current-buffer))) @@ -175,14 +176,14 @@ specifies the value of ERROR-BUFFER." (progn (setq buffer-read-only nil) (delete-region (max start end) (point-max)) (delete-region (point-min) (min start end)) + (write-region (point-min) (point-max) input-file) + (delete-region (point-min) (point-max)) (setq exit-status - (call-process-region (point-min) (point-max) - shell-file-name t - (if error-file - (list t error-file) - t) - nil shell-command-switch - command))) + (process-file shell-file-name input-file + (if error-file + (list t error-file) + t) + nil shell-command-switch command))) ;; Clear the output buffer, then run the command with ;; output there. (let ((directory default-directory)) @@ -192,11 +193,11 @@ specifies the value of ERROR-BUFFER." (setq default-directory directory)) (erase-buffer))) (setq exit-status - (call-process-region start end shell-file-name nil - (if error-file - (list buffer error-file) - buffer) - nil shell-command-switch command))) + (process-file shell-file-name nil + (if error-file + (list buffer error-file) + buffer) + nil shell-command-switch command))) ;; Report the output. (with-current-buffer buffer (setq mode-line-process @@ -230,6 +231,9 @@ specifies the value of ERROR-BUFFER." ;; (kill-buffer buffer) )))) + (when (and input-file (file-exists-p input-file)) + (delete-file input-file)) + (when (and error-file (file-exists-p error-file)) (if (< 0 (nth 7 (file-attributes error-file))) (with-current-buffer (get-buffer-create error-buffer) diff --git a/lisp/ob.el b/lisp/ob.el index b06aac11f..32ca7c6ca 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -2547,18 +2547,14 @@ Emacs shutdown.")) Passes PREFIX and SUFFIX directly to `make-temp-file' with the value of `temporary-file-directory' temporarily set to the value of `org-babel-temporary-directory'." - (if (file-remote-p default-directory) - (make-temp-file - (concat (file-remote-p default-directory) - (expand-file-name - prefix temporary-file-directory) - nil suffix)) - (let ((temporary-file-directory + (let ((temporary-file-directory + (if (file-remote-p default-directory) + (concat (file-remote-p default-directory) "/tmp") (or (and (boundp 'org-babel-temporary-directory) (file-exists-p org-babel-temporary-directory) org-babel-temporary-directory) - temporary-file-directory))) - (make-temp-file prefix nil suffix)))) + temporary-file-directory)))) + (make-temp-file prefix nil suffix))) (defun org-babel-remove-temporary-directory () "Remove `org-babel-temporary-directory' on Emacs shutdown."