From eee580c8b304efa160af5c9f11af2ffda55487f0 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Wed, 27 Feb 2013 22:10:05 +0100 Subject: [PATCH 1/3] Revert "ob-core.el: Do not ask for confirmation if cached value is current" Reverting "Fix a typo I introduced while editing Achim's commit 091bf0" Reverting "ob-core.el: Do not ask for confirmation if cached value is current" This reverts commit 091bf0251454d4a9e00fd7054a25b0097822253a. --- lisp/ob-core.el | 71 ++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 78e087be1..3278bf91a 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -521,23 +521,21 @@ Optionally supply a value for PARAMS which will be merged with the header arguments specified at the front of the source code block." (interactive) - (let* ((info (or info (org-babel-get-src-block-info))) - (params (if params - (org-babel-process-params - (org-babel-merge-params (nth 2 info) params)) - (nth 2 info))) - (cache-p (and (not arg) (cdr (assoc :cache params)) - (string= "yes" (cdr (assoc :cache params))))) - (new-hash (when cache-p (org-babel-sha1-hash info))) - (old-hash (when cache-p (org-babel-current-result-hash))) - (cache-current-p (and (not arg) new-hash (equal new-hash old-hash)))) - (when (or cache-current-p - (org-babel-confirm-evaluate - (let ((i info)) - (setf (nth 2 i) (org-babel-merge-params (nth 2 info) params)) - i))) + (let ((info (or info (org-babel-get-src-block-info)))) + (when (org-babel-confirm-evaluate + (let ((i info)) + (setf (nth 2 i) (org-babel-merge-params (nth 2 info) params)) + i)) (let* ((lang (nth 0 info)) + (params (if params + (org-babel-process-params + (org-babel-merge-params (nth 2 info) params)) + (nth 2 info))) + (cache? (and (not arg) (cdr (assoc :cache params)) + (string= "yes" (cdr (assoc :cache params))))) (result-params (cdr (assoc :result-params params))) + (new-hash (when cache? (org-babel-sha1-hash info))) + (old-hash (when cache? (org-babel-current-result-hash))) (body (setf (nth 1 info) (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) @@ -564,7 +562,7 @@ block." (funcall lang-check (symbol-name (cdr (assoc lang org-src-lang-modes)))) (error "No org-babel-execute function for %s!" lang)))) - (if cache-current-p + (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion ;; return cached result (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) @@ -578,26 +576,27 @@ block." (progn (funcall cmd body params) (message "result silenced")) - (setq result - ((lambda (result) - (if (and (eq (cdr (assoc :result-type params)) 'value) - (or (member "vector" result-params) - (member "table" result-params)) - (not (listp result))) - (list (list result)) result)) - (funcall cmd body params))) - ;; if non-empty result and :file then write to :file - (when (cdr (assoc :file params)) - (when result - (with-temp-file (cdr (assoc :file params)) - (insert - (org-babel-format-result - result (cdr (assoc :sep (nth 2 info))))))) - (setq result (cdr (assoc :file params)))) - (org-babel-insert-result - result result-params info new-hash indent lang) - (run-hooks 'org-babel-after-execute-hook) - result))) + (setq result + ((lambda (result) + (if (and (eq (cdr (assoc :result-type params)) 'value) + (or (member "vector" result-params) + (member "table" result-params)) + (not (listp result))) + (list (list result)) result)) + (funcall cmd body params))) + ;; if non-empty result and :file then write to :file + (when (cdr (assoc :file params)) + (when result + (with-temp-file (cdr (assoc :file params)) + (insert + (org-babel-format-result + result (cdr (assoc :sep (nth 2 info))))))) + (setq result (cdr (assoc :file params)))) + (org-babel-insert-result + result result-params info new-hash indent lang) + (run-hooks 'org-babel-after-execute-hook) + result + ))) (setq call-process-region 'org-babel-call-process-region-original)))))) (defun org-babel-expand-body:generic (body params &optional var-lines) From ce6339e29205f026bd1e8236e47da4636283ebef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= Date: Wed, 27 Feb 2013 22:11:43 +0100 Subject: [PATCH 2/3] org-contacts.el: Rename a function to follow emacs-lisp coding conventions * contrib/lisp/org-contacts.el (org-contacts-db-need-update-p): Replace the '?' by a '-p'. (org-contacts-db): Use the new name. --- contrib/lisp/org-contacts.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 867453390..9045087ea 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -160,7 +160,7 @@ This overrides `org-email-link-description-format' if set." "Return list of Org files to use for contact management." (or org-contacts-files (org-agenda-files t 'ifmode))) -(defun org-contacts-db-need-update? () +(defun org-contacts-db-need-update-p () "Determine whether `org-contacts-db' needs to be refreshed." (or (null org-contacts-last-update) (some (lambda (file) @@ -174,7 +174,7 @@ This overrides `org-email-link-description-format' if set." (contacts-matcher (cdr (org-make-tags-matcher org-contacts-matcher))) markers result) - (when (org-contacts-db-need-update?) + (when (org-contacts-db-need-update-p) (message "Update Org Contacts Database") (dolist (file (org-contacts-files)) (org-check-agenda-file file) From a7535ca3537a97fdf3bb397fb3adf32df69058f3 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 27 Feb 2013 23:22:51 +0100 Subject: [PATCH 3/3] ox: Fix min level computation * lisp/ox.el (org-export--get-min-level): Ignore footnote section when computing minimal headline level. --- lisp/ox.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index 8c509837f..74d0d862a 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -1784,9 +1784,9 @@ OPTIONS is a plist holding export options." (mapc (lambda (blob) (when (and (eq (org-element-type blob) 'headline) + (not (org-element-property :footnote-section-p blob)) (not (memq blob (plist-get options :ignore-list)))) - (setq min-level - (min (org-element-property :level blob) min-level))) + (setq min-level (min (org-element-property :level blob) min-level))) (when (= min-level 1) (throw 'exit 1))) (org-element-contents data)) ;; If no headline was found, for the sake of consistency, set