diff --git a/lisp/org.el b/lisp/org.el index e12565931..9566f9389 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13118,62 +13118,63 @@ decreases scheduled or deadline date by one day." ((not (stringp value)) (error "Properties values should be strings")) ((not (org--valid-property-p property)) (user-error "Invalid property name: \"%s\"" property))) - (org-with-point-at pom - (if (or (not (featurep 'org-inlinetask)) (org-inlinetask-in-task-p)) - (org-back-to-heading-or-point-min t) - (org-with-limited-levels (org-back-to-heading-or-point-min t))) - (let ((beg (point))) - (cond - ((equal property "TODO") - (cond ((not (org-string-nw-p value)) (setq value 'none)) - ((not (member value org-todo-keywords-1)) - (user-error "\"%s\" is not a valid TODO state" value))) - (org-todo value) - (org-align-tags)) - ((equal property "PRIORITY") - (org-priority (if (org-string-nw-p value) (string-to-char value) ?\s)) - (org-align-tags)) - ((equal property "SCHEDULED") - (forward-line) - (if (and (looking-at-p org-planning-line-re) - (re-search-forward - org-scheduled-time-regexp (line-end-position) t)) - (cond ((string= value "earlier") (org-timestamp-change -1 'day)) - ((string= value "later") (org-timestamp-change 1 'day)) - ((string= value "") (org-schedule '(4))) - (t (org-schedule nil value))) - (if (member value '("earlier" "later" "")) - (call-interactively #'org-schedule) - (org-schedule nil value)))) - ((equal property "DEADLINE") - (forward-line) - (if (and (looking-at-p org-planning-line-re) - (re-search-forward - org-deadline-time-regexp (line-end-position) t)) - (cond ((string= value "earlier") (org-timestamp-change -1 'day)) - ((string= value "later") (org-timestamp-change 1 'day)) - ((string= value "") (org-deadline '(4))) - (t (org-deadline nil value))) - (if (member value '("earlier" "later" "")) - (call-interactively #'org-deadline) - (org-deadline nil value)))) - ((member property org-special-properties) - (error "The %s property cannot be set with `org-entry-put'" property)) - (t - (let* ((range (org-get-property-block beg 'force)) - (end (cdr range)) - (case-fold-search t)) - (goto-char (car range)) - (if (re-search-forward (org-re-property property nil t) end t) - (progn (delete-region (match-beginning 0) (match-end 0)) - (goto-char (match-beginning 0))) - (goto-char end) - (insert "\n") - (backward-char)) - (insert ":" property ":") - (when value (insert " " value)) - (org-indent-line))))) - (run-hook-with-args 'org-property-changed-functions property value))) + (org-no-read-only + (org-with-point-at pom + (if (or (not (featurep 'org-inlinetask)) (org-inlinetask-in-task-p)) + (org-back-to-heading-or-point-min t) + (org-with-limited-levels (org-back-to-heading-or-point-min t))) + (let ((beg (point))) + (cond + ((equal property "TODO") + (cond ((not (org-string-nw-p value)) (setq value 'none)) + ((not (member value org-todo-keywords-1)) + (user-error "\"%s\" is not a valid TODO state" value))) + (org-todo value) + (org-align-tags)) + ((equal property "PRIORITY") + (org-priority (if (org-string-nw-p value) (string-to-char value) ?\s)) + (org-align-tags)) + ((equal property "SCHEDULED") + (forward-line) + (if (and (looking-at-p org-planning-line-re) + (re-search-forward + org-scheduled-time-regexp (line-end-position) t)) + (cond ((string= value "earlier") (org-timestamp-change -1 'day)) + ((string= value "later") (org-timestamp-change 1 'day)) + ((string= value "") (org-schedule '(4))) + (t (org-schedule nil value))) + (if (member value '("earlier" "later" "")) + (call-interactively #'org-schedule) + (org-schedule nil value)))) + ((equal property "DEADLINE") + (forward-line) + (if (and (looking-at-p org-planning-line-re) + (re-search-forward + org-deadline-time-regexp (line-end-position) t)) + (cond ((string= value "earlier") (org-timestamp-change -1 'day)) + ((string= value "later") (org-timestamp-change 1 'day)) + ((string= value "") (org-deadline '(4))) + (t (org-deadline nil value))) + (if (member value '("earlier" "later" "")) + (call-interactively #'org-deadline) + (org-deadline nil value)))) + ((member property org-special-properties) + (error "The %s property cannot be set with `org-entry-put'" property)) + (t + (let* ((range (org-get-property-block beg 'force)) + (end (cdr range)) + (case-fold-search t)) + (goto-char (car range)) + (if (re-search-forward (org-re-property property nil t) end t) + (progn (delete-region (match-beginning 0) (match-end 0)) + (goto-char (match-beginning 0))) + (goto-char end) + (insert "\n") + (backward-char)) + (insert ":" property ":") + (when value (insert " " value)) + (org-indent-line))))) + (run-hook-with-args 'org-property-changed-functions property value)))) (defun org-buffer-property-keys (&optional specials defaults columns) "Get all property keys in the current buffer.