Browse Source

org-colview: Fix failing test

* lisp/org-colview.el (org-columns-new): Tiny refactoring.
* testing/lisp/test-org-colview.el (test-org-colview/columns-new): Fix
  typo in test.
Nicolas Goaziou 5 years ago
parent
commit
2b3c72e231
2 changed files with 4 additions and 7 deletions
  1. 3 6
      lisp/org-colview.el
  2. 1 1
      testing/lisp/test-org-colview.el

+ 3 - 6
lisp/org-colview.el

@@ -837,12 +837,9 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
 	 (summarize (and prop operator (org-columns--summarize operator)))
 	 (edit
 	  (and prop (assoc-string prop org-columns-current-fmt-compiled t))))
-    (cond (edit (setcdr edit (list title width operator nil summarize)))
-	  ((= (current-column) 0)
-	   (push (list prop title width operator nil summarize)
-		 org-columns-current-fmt-compiled))
-	  (t (push (list prop title width operator nil summarize)
-		   (nthcdr (current-column) org-columns-current-fmt-compiled))))
+    (if edit (setcdr edit (list title width operator nil summarize))
+      (push (list prop title width operator nil summarize)
+	    (nthcdr (current-column) org-columns-current-fmt-compiled)))
     (org-columns-store-format)
     (org-columns-redo)))
 

+ 1 - 1
testing/lisp/test-org-colview.el

@@ -534,7 +534,7 @@
 	    (list (get-char-property (point) 'org-columns-key)
 		  (get-char-property (1+ (point)) 'org-columns-key)))))
   (should
-   (equal '("ITEM" "FOO" "ITEM")
+   (equal '("ITEM" "FOO" "BAR")
 	  (org-test-with-temp-text "* H"
 	    (let ((org-columns-default-format "%ITEM %BAR")) (org-columns))
 	    (forward-char)