diff options
| -rw-r--r-- | llama.el | 27 |
1 files changed, 9 insertions, 18 deletions
@@ -290,8 +290,8 @@ explicitly specified `_%3'." (string-to-syntax "'"))))) start end))) -(define-advice completing-read (:around (fn &rest args) llama) - "Unintern the symbol with the empty name during completion. +(define-advice all-completions (:around (fn str table &rest rest) llama) + "Remove empty symbol from completion results if originating from `llama'. `##' is the notation for the symbol whose name is the empty string. (intern \"\") => ## @@ -303,22 +303,13 @@ it to be used akin to syntax, without actually being new syntax. alias for `llama', you can access the documentation under that name.) This advice prevents the empty string from being offered as a completion -candidate when `obarray' (or a completion table that internally uses -that) is used as COLLECTION, by `unintern'ing that symbol temporarily." - (let ((plist (symbol-plist '##)) - (value nil) - (bound nil)) - (with-no-warnings - (when (boundp '##) - (setq bound t) - (setq value ##))) - (unwind-protect - (progn (unintern "" obarray) - (apply fn args)) - (defalias (intern "") 'llama) - (setplist (intern "") plist) - (when bound - (set (intern "") value))))) +candidate when `obarray' or a completion table that internally uses +that is used as TABLE." + (let ((result (apply fn str table rest))) + (if (and (obarrayp table) + (eq (symbol-function (intern-soft "" table)) 'llama)) + (delete "" result) + result))) (defvar llama-fontify-mode) |
