[PATCH] lisp/ob-shell.el: Also override explicit-shell-file-name
* lisp/ob-shell.el (org-babel-shell-initialize): Override explicit-shell-file-name in addition to shell-file-name. When a session with shell source blocks, execution calls `shell', which checks `explicit-shell-file-name' variable before `shell-file-name', to determine what shell to run. If the user has customized this variable to affect the behavior of M-x shell, `org-babel-shell-initialize' should still run the shell specified by the org source block's language name. TINYCHANGE --- lisp/ob-shell.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ob-shell.el b/lisp/ob-shell.el index 551c3785d..35d9e9376 100644 --- a/lisp/ob-shell.el +++ b/lisp/ob-shell.el @@ -81,7 +81,8 @@ is modified outside the Customize interface." (lambda (body params) (:documentation (format "Execute a block of %s commands with Babel." name)) - (let ((shell-file-name name)) + (let ((explicit-shell-file-name name) +(shell-file-name name)) (org-babel-execute:shell body params (put fname 'definition-name 'org-babel-shell-initialize)) (defalias (intern (concat "org-babel-variable-assignments:" name)) -- 2.42.0
[PATCH] Make predicates non-interactive
Predicates like `org-first-sibling-p' are no use when called interactively, and should not appear in the M-x prompt. TINYCHANGE --- lisp/org.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 23cb6012d..20e6ea6d9 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9876,7 +9876,6 @@ inactive time ranges. When this function returns a non-nil value, match data is set according to `org-tr-regexp-both' or `org-tr-regexp', depending on INACTIVE-OK." - (interactive) (save-excursion (catch 'exit (let ((pos (point))) @@ -15475,7 +15474,6 @@ If Org mode thinks that point is actually inside an embedded LaTeX environment, return t when the environment is math or let `texmathp' do its job otherwise. `\\[org-cdlatex-mode-map]'" - (interactive) (cond ((not (derived-mode-p 'org-mode)) (apply orig-fun args)) ((eq this-command 'cdlatex-math-symbol) @@ -20525,7 +20523,6 @@ point before the first headline or at point-min." (defun org-first-sibling-p () "Is this heading the first child of its parents?" - (interactive) (let ((re org-outline-regexp-bol) level l) (unless (org-at-heading-p t) -- 2.38.4
[PATCH] org--batch-store-agenda-views: Fix treatment of lambda functions
* org-agenda.el (org--batch-store-agenda-views): Fix treatment of lambda functions used as custom agenda commands. `org-agenda-custom-commands' entries may specify a custom function instead of a symbol like `tags-todo'. `org--batch-store-agenda-views' behaved differently from `org-agenda' when that custom function was defined as a lambda rather than a symbol, incorrectly treating the lambda form as a list of agenda commands. Instead, use the same test as `org-agenda' does to determine whether the command is a series. --- lisp/org-agenda.el | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 1d1f2271b..49f93c338 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3525,10 +3525,13 @@ This ensures the export commands can easily use it." (let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands)) (pop-up-frames nil) (dir default-directory) -cmd thiscmdkey thiscmdcmd match files opts cmd-or-set bufname) +cmd thiscmdkey thiscmdcmd match files opts cmd-or-set +seriesp bufname) (save-window-excursion (while cmds (setq cmd (pop cmds) + ;; series: (0:key 1:desc 2:(cmd1 cmd2 ...) 3:general-settings 4:files) + ;; non-series: (0:key 1:desc 2:type 3:match4:settings 5:files) thiscmdkey (car cmd) thiscmdcmd (cdr cmd) match (nth 2 thiscmdcmd) @@ -3538,8 +3541,9 @@ This ensures the export commands can easily use it." (format "*Org Agenda(%s)*" thiscmdkey)) org-agenda-buffer-name) cmd-or-set (nth 2 cmd) - opts (nth (if (listp cmd-or-set) 3 4) cmd) - files (nth (if (listp cmd-or-set) 4 5) cmd)) + seriesp (not (or (symbolp cmd-or-set) (functionp cmd-or-set))) + opts (nth (if seriesp 3 4) cmd) + files (nth (if seriesp 4 5) cmd)) (if (stringp files) (setq files (list files))) (when files (let* ((opts (append org-agenda-exporter-settings opts)) -- 2.38.1
[PATCH] org--batch-store-agenda-views: Fix treatment of lambda functions
`org-agenda-custom-commands' entries may specify a custom function instead of a symbol like `tags-todo'. `org--batch-store-agenda-views' behaved differently from `org-agenda' when that custom function was defined as a lambda rather than a symbol, incorrectly treating the lambda form as a list of agenda commands. This patch makes `org--batch-store-agenda-views' use the same test as `org-agenda' does to determine whether the command is a series. --- lisp/org-agenda.el | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 1d1f2271b..1aab64820 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3525,7 +3525,8 @@ This ensures the export commands can easily use it." (let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands)) (pop-up-frames nil) (dir default-directory) -cmd thiscmdkey thiscmdcmd match files opts cmd-or-set bufname) +cmd thiscmdkey thiscmdcmd match files opts cmd-or-set +seriesp bufname) (save-window-excursion (while cmds (setq cmd (pop cmds) @@ -3538,8 +3539,9 @@ This ensures the export commands can easily use it." (format "*Org Agenda(%s)*" thiscmdkey)) org-agenda-buffer-name) cmd-or-set (nth 2 cmd) - opts (nth (if (listp cmd-or-set) 3 4) cmd) - files (nth (if (listp cmd-or-set) 4 5) cmd)) + seriesp (not (or (symbolp cmd-or-set) (functionp cmd-or-set))) + opts (nth (if seriesp 3 4) cmd) + files (nth (if seriesp 4 5) cmd)) (if (stringp files) (setq files (list files))) (when files (let* ((opts (append org-agenda-exporter-settings opts)) -- 2.38.1
[PATCH] lisp/org-agenda.el: Fix void-function string-pad in Emacs <28.1
* org-compat.el (org-string-pad): Add compatibility function `org-string-pad' for `string-pad', introduced in Emacs 28.1. * org-agenda.el (org-fix-agenda-info): Use `org-string-pad' rather than `string-pad'. Since this is more-or-less just copying string-pad's definition from subr-x.el, I think this qualifies for TINYCHANGE. TINYCHANGE --- lisp/org-agenda.el | 4 ++-- lisp/org-compat.el | 21 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 2d194ad34..4f0522086 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3474,13 +3474,13 @@ This ensures the export commands can easily use it." (when (setq tmp (plist-get props 'date)) (when (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) (let ((calendar-date-display-form - '(year "-" (string-pad month 2 ?0 'left) "-" (string-pad day 2 ?0 'left + '(year "-" (org-string-pad month 2 ?0 'left) "-" (org-string-pad day 2 ?0 'left (setq tmp (calendar-date-string tmp))) (setq props (plist-put props 'date tmp))) (when (setq tmp (plist-get props 'day)) (when (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) (let ((calendar-date-display-form - '(year "-" (string-pad month 2 ?0 'left) "-" (string-pad day 2 ?0 'left + '(year "-" (org-string-pad month 2 ?0 'left) "-" (org-string-pad day 2 ?0 'left (setq tmp (calendar-date-string tmp))) (setq props (plist-put props 'day tmp)) (setq props (plist-put props 'agenda-day tmp))) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 6c5085255..eb20d5baf 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -173,6 +173,27 @@ removed." (string-trim (replace-regexp-in-string blank " " string t t) blank blank +(if (fboundp 'string-pad) +(defalias 'org-string-pad #'string-pad) + ;; From Emacs subr-x.el. + (defun org-string-pad (string length padding start) +"Pad STRING to LENGTH using PADDING. +If PADDING is nil, the space character is used. If not nil, it +should be a character. + +If STRING is longer than the absolute value of LENGTH, no padding +is done. + +If START is nil (or not present), the padding is done to the end +of the string, and if non-nil, padding is done to the start of +the string." +(unless (natnump length) + (signal 'wrong-type-argument (list 'natnump length))) +(let ((pad-length (- length (length string + (cond ((<= pad-length 0) string) +(start (concat (make-string pad-length (or padding ?\s)) string)) +(t (concat string (make-string pad-length (or padding ?\s + (if (fboundp 'format-prompt) (defalias 'org-format-prompt #'format-prompt) ;; From Emacs minibuffer.el, inlining -- 2.38.1
[PATCH] org-agenda-with-point-at-orig-entry: Fix body indentation
--- lisp/org-agenda.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 76f71e33e..021d36657 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -2124,7 +2124,7 @@ argument to `set-category' for each entry it's called against." If STRING is non-nil, the text property will be fetched from position 0 in that string. If STRING is nil, it will be fetched from the beginning of the current line." - (declare (debug t)) + (declare (debug t) (indent 1)) (org-with-gensyms (marker) `(let ((,marker (get-text-property (if ,string 0 (point-at-bol)) 'org-hd-marker ,string))) -- 2.36.0
[PATCH] org-todo-yesterday: Fix interactive arg when in agenda buffer
(I'm resubmitting this patch because my previous submission was in-reply-to another email which I suspect was ignored. Would love to get this relatively simple bug fixed. Thanks!) * lisp/org.el (org-todo-yesterday): Fix an incorrect use of apply when org-todo-yesterday intends to call org-agenda-todo-yesterday with the same interactive arg. Before this change, the command incorrectly set the todo state of the task to blank when called with C-u C-u C-u in an agenda buffer (supposed to bypass any blocked checkboxes/subtasks). TINYCHANGE --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 6842bfe9b..b3b9c777b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9666,7 +9666,7 @@ nil or a string to be used for the todo mark." ) "Like `org-todo' but the time of change will be 23:59 of yesterday." (interactive "P") (if (eq major-mode 'org-agenda-mode) - (apply 'org-agenda-todo-yesterday arg) + (org-agenda-todo-yesterday arg) (let* ((org-use-effective-time t) (hour (nth 2 (decode-time (org-current-time (org-extend-today-until (1+ hour))) -- 2.33.3
[PATCH] org-todo-yesterday: Fix interactive arg when in agenda buffer
* lisp/org.el (org-todo-yesterday): Fix an incorrect use of apply when org-todo-yesterday intends to call org-agenda-todo-yesterday with the same interactive arg. Before this change, the command incorrectly set the todo state of the task to blank when called with C-u C-u C-u in an agenda buffer (supposed to bypass any blocked checkboxes/subtasks). TINYCHANGE --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 54350faee..5e326e765 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9665,7 +9665,7 @@ nil or a string to be used for the todo mark." ) "Like `org-todo' but the time of change will be 23:59 of yesterday." (interactive "P") (if (eq major-mode 'org-agenda-mode) - (apply 'org-agenda-todo-yesterday arg) + (org-agenda-todo-yesterday arg) (let* ((org-use-effective-time t) (hour (nth 2 (decode-time (org-current-time (org-extend-today-until (1+ hour))) -- 2.33.1
Re: Bug: Infinite loop in org-agenda-dim-blocked-tasks
(Sorry, I am resending this email because I found out gmail doesn't support In-Reply-To in mailto: links). Unfortunately, I think this bug is still there (I also didn't see any commits addressing it, but I could have missed it in the log somewhere). I tried the master branch but was still able to reproduce the bug using `emacs -q -L ~/src/org-mode/lisp`: After using `customize-set-variable` to enable org-enforce-todo-checkbox-dependencies, with the following agenda file: * TODO blocked task - [ ] checkbox Trying to clock into the task from org-todo-list results in an infinite loop. Thanks, Aaron
[PATCH] ol.el: Fix confusing variable name
* ol.el (org-link--open-help): Fix a confusing variable name. No behavior changes. TINYCHANGE --- lisp/ol.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/ol.el b/lisp/ol.el index 62ea6d2bc..617223cb5 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1325,8 +1325,8 @@ PATH is the sexp to evaluate, as a string." "Open a \"help\" type link. PATH is a symbol name, as a string." (pcase (intern path) -((and (pred fboundp) variable) (describe-function variable)) -((and (pred boundp) function) (describe-variable function)) +((and (pred fboundp) function) (describe-function function)) +((and (pred boundp) variable) (describe-variable variable)) (name (user-error "Unknown function or variable: %s" name (defun org-link--store-help () -- 2.31.1