summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-02-25 00:33:28 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-02-25 00:33:28 +0100
commit71d734f399c01244e3c3cc36dce2600aa1fcba51 (patch)
tree68d4f609fcaeddf371303d603b09821ed8cea8cb
parent41d005822ebfd1c8b65e4ae3bb3d51aea7ef47f3 (diff)
downloadorg-mode-71d734f399c01244e3c3cc36dce2600aa1fcba51.tar.gz
org-colview: Prevent computing again values in some cases
* lisp/org-colview.el (org-columns-delete): (org-columns-widen): Do not recompute value.
-rw-r--r--lisp/org-colview.el21
1 files changed, 11 insertions, 10 deletions
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index a90e2d1..a27619d 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -864,17 +864,18 @@ details."
(defun org-columns-delete ()
"Delete the column at point from columns view."
(interactive)
- (let* ((n (current-column))
- (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\"? " title))
+ (let ((spec (nth (current-column) org-columns-current-fmt-compiled)))
+ (when (y-or-n-p (format "Are you sure you want to remove column %S? "
+ (nth 1 spec)))
(setq org-columns-current-fmt-compiled
- (delq (nth n org-columns-current-fmt-compiled)
- org-columns-current-fmt-compiled))
+ (delq spec org-columns-current-fmt-compiled))
(org-columns-store-format)
- (org-columns-redo)
- (if (>= (current-column) (length org-columns-current-fmt-compiled))
- (backward-char 1)))))
+ ;; This may leave a now wrong value in a node property. However
+ ;; updating it may prove counter-intuitive. See comments in
+ ;; `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 ()
"Edit the attributes of the current column."
@@ -890,7 +891,7 @@ details."
(setq width (max 1 (+ width arg)))
(setcar (nthcdr 2 entry) width)
(org-columns-store-format)
- (org-columns-redo)))
+ (let ((org-columns-inhibit-recalculation t)) (org-columns-redo))))
(defun org-columns-narrow (arg)
"Make the column narrower by ARG characters."