Browse Source

Priorities: Conditionally disable priority commands

The new option `org-enable-priority-commands' can now be used to turn
off all priority-setting commands, to avoid setting a priority by
accident.
Carsten Dominik 16 năm trước cách đây
mục cha
commit
86a19f342e
3 tập tin đã thay đổi với 20 bổ sung0 xóa
  1. 7 0
      lisp/ChangeLog
  2. 2 0
      lisp/org-agenda.el
  3. 11 0
      lisp/org.el

+ 7 - 0
lisp/ChangeLog

@@ -1,5 +1,12 @@
 2009-05-21  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-priority, org-shiftup, org-shiftdown): Disable
+	priority commands.
+
+	* org-agenda.el (org-agenda-priority): Disable priority commands.
+
+	* org.el (org-enable-priority-commands): New option.
+
 	* org-colview-xemacs.el (org-columns-compute)
 	(org-columns-number-to-string): Fix problems with empty fields.
 

+ 2 - 0
lisp/org-agenda.el

@@ -5683,6 +5683,8 @@ If FORCE-TAGS is non nil, the car of it returns the new tags."
 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-mode file."
   (interactive)
+  (unless org-enable-priority-commands
+    (error "Priority commands are disabled"))
   (org-agenda-check-no-diary)
   (let* ((marker (or (get-text-property (point) 'org-marker)
 		     (org-agenda-error)))

+ 11 - 0
lisp/org.el

@@ -2001,6 +2001,13 @@ property to one or more of these keywords."
   :tag "Org Priorities"
   :group 'org-todo)
 
+(defcustom org-enable-priority-commands t
+  "Non-nil means, priority commands are active.
+When nil, these commands will be disabled, so that you never accidentally
+set a priority."
+  :group 'org-priorities
+  :type 'boolean)
+
 (defcustom org-highest-priority ?A
   "The highest priority of TODO items.  A character like ?A, ?B etc.
 Must have a smaller ASCII number than `org-lowest-priority'."
@@ -10313,6 +10320,8 @@ from the `before-change-functions' in the current buffer."
   "Change the priority of an item by ARG.
 ACTION can be `set', `up', `down', or a character."
   (interactive)
+  (unless org-enable-priority-commands
+    (error "Priority commands are disabled"))
   (setq action (or action 'set))
   (let (current new news have remove)
     (save-excursion
@@ -14418,6 +14427,7 @@ depending on context.  See the individual commands for more information."
     (call-interactively (if org-edit-timestamp-down-means-later
 			    'org-timestamp-down 'org-timestamp-up)))
    ((and (not (eq org-support-shift-select 'always))
+	 org-enable-priority-commands
 	 (org-on-heading-p))
     (call-interactively 'org-priority-up))
    ((and (not org-support-shift-select) (org-at-item-p))
@@ -14439,6 +14449,7 @@ depending on context.  See the individual commands for more information."
     (call-interactively (if org-edit-timestamp-down-means-later
 			    'org-timestamp-up 'org-timestamp-down)))
    ((and (not (eq org-support-shift-select 'always))
+	 org-enable-priority-commands
 	 (org-on-heading-p))
     (call-interactively 'org-priority-down))
    ((and (not org-support-shift-select) (org-at-item-p))