org-colview: Prevent computing again values in some cases

* lisp/org-colview.el (org-columns-delete):
(org-columns-widen): Do not recompute value.
This commit is contained in:
Nicolas Goaziou 2016-02-25 00:33:28 +01:00
parent 41d005822e
commit 71d734f399

View file

@ -864,17 +864,18 @@ details."
(defun org-columns-delete () (defun org-columns-delete ()
"Delete the column at point from columns view." "Delete the column at point from columns view."
(interactive) (interactive)
(let* ((n (current-column)) (let ((spec (nth (current-column) org-columns-current-fmt-compiled)))
(title (nth 1 (nth n org-columns-current-fmt-compiled)))) (when (y-or-n-p (format "Are you sure you want to remove column %S? "
(when (y-or-n-p (nth 1 spec)))
(format "Are you sure you want to remove column \"%s\"? " title))
(setq org-columns-current-fmt-compiled (setq org-columns-current-fmt-compiled
(delq (nth n org-columns-current-fmt-compiled) (delq spec org-columns-current-fmt-compiled))
org-columns-current-fmt-compiled))
(org-columns-store-format) (org-columns-store-format)
(org-columns-redo) ;; This may leave a now wrong value in a node property. However
(if (>= (current-column) (length org-columns-current-fmt-compiled)) ;; updating it may prove counter-intuitive. See comments in
(backward-char 1))))) ;; `org-columns-move-right' for details.
(let ((org-columns-inhibit-recalculation t)) (org-columns-redo))
(when (>= (current-column) (length org-columns-current-fmt-compiled))
(backward-char)))))
(defun org-columns-edit-attributes () (defun org-columns-edit-attributes ()
"Edit the attributes of the current column." "Edit the attributes of the current column."
@ -890,7 +891,7 @@ details."
(setq width (max 1 (+ width arg))) (setq width (max 1 (+ width arg)))
(setcar (nthcdr 2 entry) width) (setcar (nthcdr 2 entry) width)
(org-columns-store-format) (org-columns-store-format)
(org-columns-redo))) (let ((org-columns-inhibit-recalculation t)) (org-columns-redo))))
(defun org-columns-narrow (arg) (defun org-columns-narrow (arg)
"Make the column narrower by ARG characters." "Make the column narrower by ARG characters."