Function: org-columns-edit-value

org-columns-edit-value is an interactive and byte-compiled function defined in org-colview.el.gz.

Signature

(org-columns-edit-value &optional KEY)

Documentation

Edit the value of the property at point in column view.

Where possible, use the standard interface for changing this line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-colview.el.gz
(defun org-columns-edit-value (&optional key)
  "Edit the value of the property at point in column view.
Where possible, use the standard interface for changing this line."
  (interactive)
  (org-columns-check-computed)
  (let* ((col (current-column))
	 (bol (line-beginning-position))
	 (eol (line-end-position))
	 (pom (or (get-text-property bol 'org-hd-marker) (point)))
	 (key (or key (get-char-property (point) 'org-columns-key)))
	 (org-columns--time (float-time))
	 (action
	  (pcase key
	    ("CLOCKSUM"
	     (user-error "This special column cannot be edited"))
	    ("ITEM"
	     (lambda () (org-with-point-at pom (org-edit-headline))))
	    ("TODO"
	     (lambda ()
	       (org-with-point-at pom (call-interactively #'org-todo))))
	    ("PRIORITY"
	     (lambda ()
	       (org-with-point-at pom
		 (call-interactively #'org-priority))))
	    ("TAGS"
	     (lambda ()
	       (org-with-point-at pom
		 (let ((org-fast-tag-selection-single-key
			(if (eq org-fast-tag-selection-single-key 'expert)
			    t
			  org-fast-tag-selection-single-key)))
		   (call-interactively #'org-set-tags-command)))))
	    ("DEADLINE"
	     (lambda ()
	       (org-with-point-at pom (call-interactively #'org-deadline))))
	    ("SCHEDULED"
	     (lambda ()
	       (org-with-point-at pom (call-interactively #'org-schedule))))
	    ("BEAMER_ENV"
	     (lambda ()
	       (org-with-point-at pom
		 (call-interactively #'org-beamer-select-environment))))
	    (_
	     (let* ((allowed (org-property-get-allowed-values pom key 'table))
		    (value (get-char-property (point) 'org-columns-value))
		    (nval (org-trim
			   (if (null allowed) (read-string "Edit: " value)
			     (completing-read
			      "Value: " allowed nil
			      (not (get-text-property
				    0 'org-unrestricted (caar allowed))))))))
	       (and (not (equal nval value))
		    (lambda () (org-entry-put pom key nval))))))))
    (cond
     ((null action))
     ((eq major-mode 'org-agenda-mode)
      (org-columns--call action)
      ;; The following let preserves the current format, and makes
      ;; sure that in only a single file things need to be updated.
      (let* ((org-overriding-columns-format org-columns-current-fmt)
	     (buffer (marker-buffer pom))
	     (org-agenda-contributing-files
	      (list (with-current-buffer buffer
		      (buffer-file-name (buffer-base-buffer))))))
	(org-agenda-columns)))
     (t
      (let ((inhibit-read-only t))
	(with-silent-modifications
	  (remove-text-properties (max (point-min) (1- bol)) eol '(read-only t)))
	(org-columns--call action))
      ;; Some properties can modify headline (e.g., "TODO"), and
      ;; possible shuffle overlays.  Make sure they are still all at
      ;; the right place on the current line.
      (let ((org-columns-inhibit-recalculation)) (org-columns-redo))
      (org-columns-update key)
      (org-move-to-column col)))))