emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/org e080eb7 5/6: lisp/org-agenda.el: Small refactoring


From: ELPA Syncer
Subject: [elpa] externals/org e080eb7 5/6: lisp/org-agenda.el: Small refactoring and docstring enhancement
Date: Sat, 1 May 2021 06:57:16 -0400 (EDT)

branch: externals/org
commit e080eb759ab8bd45a4df10597ce5ae6385469e2b
Author: Bastien Guerry <bzg@gnu.org>
Commit: Bastien Guerry <bzg@gnu.org>

    lisp/org-agenda.el: Small refactoring and docstring enhancement
    
    * lisp/org-agenda.el (org-agenda-priority): Small refactoring
    and docstring enhancement.
    
    Link: https://orgmode.org/list/87o8j3360f.fsf@kyleam.com/
---
 lisp/org-agenda.el | 54 ++++++++++++++++++++++++++++--------------------------
 1 file changed, 28 insertions(+), 26 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index a832bd0..d316f32 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9570,33 +9570,35 @@ current line."
 
 (defun org-agenda-priority (&optional force-direction)
   "Set the priority of line at point, also in Org file.
-This changes the line at point, all other lines in the agenda referring to
-the same tree node, and the headline of the tree node in the Org file.
-Called with a universal prefix arg, show the priority instead of setting it."
+This changes the line at point, all other lines in the agenda
+referring to the same tree node, and the headline of the tree
+node in the Org file.
+
+Called with one universal prefix arg, show the priority instead
+of setting it.
+
+When called programmatically, FORCE-DIRECTION can be `set', `up',
+`down', or a character."
   (interactive "P")
-  (if (equal force-direction '(4))
-      (org-priority-show)
-    (unless org-priority-enable-commands
-      (user-error "Priority commands are disabled"))
-    (org-agenda-check-no-diary)
-    (let* ((col (current-column))
-          ;; (marker (or (org-get-at-bol 'org-marker)
-          ;;             (org-agenda-error)))
-          (hdmarker (org-get-at-bol 'org-hd-marker))
-          (buffer (marker-buffer hdmarker))
-          (pos (marker-position hdmarker))
-          (inhibit-read-only t)
-          newhead)
-      (org-with-remote-undo buffer
-       (with-current-buffer buffer
-         (widen)
-         (goto-char pos)
-         (org-show-context 'agenda)
-         (org-priority force-direction)
-         (end-of-line 1)
-         (setq newhead (org-get-heading)))
-       (org-agenda-change-all-lines newhead hdmarker)
-       (org-move-to-column col)))))
+  (unless org-priority-enable-commands
+    (user-error "Priority commands are disabled"))
+  (org-agenda-check-no-diary)
+  (let* ((col (current-column))
+        (hdmarker (org-get-at-bol 'org-hd-marker))
+        (buffer (marker-buffer hdmarker))
+        (pos (marker-position hdmarker))
+        (inhibit-read-only t)
+        newhead)
+    (org-with-remote-undo buffer
+      (with-current-buffer buffer
+       (widen)
+       (goto-char pos)
+       (org-show-context 'agenda)
+       (org-priority force-direction)
+       (end-of-line 1)
+       (setq newhead (org-get-heading)))
+      (org-agenda-change-all-lines newhead hdmarker)
+      (org-move-to-column col))))
 
 ;; FIXME: should fix the tags property of the agenda line.
 (defun org-agenda-set-tags (&optional tag onoff)



reply via email to

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