Browse Source

Forbid empty string as org-ellipsis value

* lisp/org.el (org-ellipsis): Harden :safe value.
(org-display-table): Fix typo.
(org-mode): Only change ellipsis if `org-ellipsis' is a non-empty
string.  Remove obsolete checks.

Reported-by: Michael Ax <>
Nicolas Goaziou 4 years ago
1 changed files with 6 additions and 8 deletions
  1. 6 8

+ 6 - 8

@@ -1119,8 +1119,8 @@ Or return the original if not disputed."
 (defcustom org-ellipsis nil
   "The ellipsis to use in the Org mode outline.
-When nil, just use the standard three dots.
-When a string, use that string instead.
+When nil, just use the standard three dots.  When a non-empty string,
+use that string instead.
 The change affects only Org mode (which will then use its own display table).
 Changing this requires executing `\\[org-mode]' in a buffer to become
@@ -1128,10 +1128,10 @@ effective."
   :group 'org-startup
   :type '(choice (const :tag "Default" nil)
 		 (string :tag "String" :value "...#"))
-  :safe #'string-or-null-p)
+  :safe (lambda (v) (and (string-or-null-p v) (not (equal "" v)))))
 (defvar org-display-table nil
-  "The display table for org-mode, in case `org-ellipsis' is non-nil.")
+  "The display table for Org mode, in case `org-ellipsis' is non-nil.")
 (defgroup org-keywords nil
   "Keywords in Org mode."
@@ -5582,15 +5582,13 @@ The following commands are available:
   (setq-local outline-regexp org-outline-regexp)
   (setq-local outline-level 'org-outline-level)
   (setq bidi-paragraph-direction 'left-to-right)
-  (when (and org-ellipsis
-             (fboundp 'set-display-table-slot) (boundp 'buffer-display-table)
-	     (fboundp 'make-glyph-code))
+  (when (and (stringp org-ellipsis) (not (equal "" org-ellipsis)))
     (unless org-display-table
       (setq org-display-table (make-display-table)))
      org-display-table 4
      (vconcat (mapcar (lambda (c) (make-glyph-code c 'org-ellipsis))
-		      (if (stringp org-ellipsis) org-ellipsis "..."))))
+		      org-ellipsis)))
     (setq buffer-display-table org-display-table))