diff options
| -rw-r--r-- | README.org | 10 | ||||
| -rw-r--r-- | cape.el | 16 |
2 files changed, 13 insertions, 13 deletions
@@ -25,8 +25,8 @@ trigger the respective completion at point. You can bind them directly to a key in your user configuration. Notable commands/Capfs are ~cape-line~ for completion of a line from the current buffer, ~cape-history~ for history completion in shell or Comint modes and ~cape-file~ for completion of file names. The commands -~cape-symbol~ and ~cape-elisp-block~ are useful for documentation of Elisp packages -or configurations, since they complete Elisp anywhere. +~cape-elisp-symbol~ and ~cape-elisp-block~ are useful for documentation of Elisp +packages or configurations, since they complete Elisp anywhere. Cape has the super power to transform Company backends into Capfs and merge multiple Capfs into a Super-Capf! These transformers allow you to still take @@ -39,10 +39,10 @@ advantage of Company backends even if you are not using Company as frontend. + ~cape-dabbrev~: Complete word from current buffers. See also ~dabbrev-capf~ on Emacs 29. + ~cape-elisp-block~: Complete Elisp in Org or Markdown code block. ++ ~cape-elisp-symbol~: Complete Elisp symbol. + ~cape-file~: Complete file name. + ~cape-history~: Complete from Eshell, Comint or minibuffer history. + ~cape-keyword~: Complete programming language keyword. -+ ~cape-symbol~: Complete Elisp symbol. + ~cape-abbrev~: Complete abbreviation (~add-global-abbrev~, ~add-mode-abbrev~). + ~cape-dict~: Complete word from dictionary file. + ~cape-line~: Complete entire line from current buffer. @@ -92,7 +92,7 @@ information. ("C-c p h" . cape-history) ("C-c p f" . cape-file) ("C-c p k" . cape-keyword) - ("C-c p s" . cape-symbol) + ("C-c p s" . cape-elisp-symbol) ("C-c p e" . cape-elisp-block) ("C-c p a" . cape-abbrev) ("C-c p l" . cape-line) @@ -117,7 +117,7 @@ information. ;;(add-to-list 'completion-at-point-functions #'cape-rfc1345) ;;(add-to-list 'completion-at-point-functions #'cape-abbrev) ;;(add-to-list 'completion-at-point-functions #'cape-dict) - ;;(add-to-list 'completion-at-point-functions #'cape-symbol) + ;;(add-to-list 'completion-at-point-functions #'cape-elisp-symbol) ;;(add-to-list 'completion-at-point-functions #'cape-line) ) #+end_src @@ -35,7 +35,7 @@ ;; `cape-file': Complete file name ;; `cape-history': Complete from Eshell, Comint or minibuffer history ;; `cape-keyword': Complete programming language keyword -;; `cape-symbol': Complete Elisp symbol +;; `cape-elisp-symbol': Complete Elisp symbol ;; `cape-abbrev': Complete abbreviation (add-global-abbrev, add-mode-abbrev) ;; `cape-dict': Complete word from dictionary file ;; `cape-line': Complete entire line from file @@ -119,7 +119,7 @@ The buffers are scanned for completion candidates by `cape-line'." (const :tag "Buffers with same major mode" cape--buffers-major-mode) (function :tag "Custom function"))) -(defcustom cape-symbol-wrapper +(defcustom cape-elisp-symbol-wrapper '((org-mode ?= ?=) (markdown-mode ?` ?`) (rst-mode "``" "``") @@ -404,7 +404,7 @@ If INTERACTIVE is nil the function acts like a Capf." '(:company-prefix-length t)) ,@cape--file-properties))))) -;;;;; cape-symbol +;;;;; cape-elisp-symbol (defvar cape--symbol-properties (append @@ -421,17 +421,17 @@ If INTERACTIVE is nil the function acts like a Capf." :company-doc-buffer 'elisp--company-doc-buffer :company-docsig 'elisp--company-doc-string :company-location 'elisp--company-location))) - "Completion extra properties for `cape-symbol'.") + "Completion extra properties for `cape-elisp-symbol'.") (defun cape--symbol-predicate (sym) "Return t if SYM is bound, fbound or propertized." (or (fboundp sym) (boundp sym) (symbol-plist sym))) (defun cape--symbol-exit (name status) - "Wrap symbol NAME with `cape-symbol-wrapper' buffers. + "Wrap symbol NAME with `cape-elisp-symbol-wrapper' buffers. STATUS is the exit status." (when-let (((not (eq status 'exact))) - (c (cl-loop for (m . c) in cape-symbol-wrapper + (c (cl-loop for (m . c) in cape-elisp-symbol-wrapper if (derived-mode-p m) return c))) (save-excursion (backward-char (length name)) @@ -453,14 +453,14 @@ STATUS is the exit status." (t " Symbol"))) ;;;###autoload -(defun cape-symbol (&optional interactive) +(defun cape-elisp-symbol (&optional interactive) "Complete Elisp symbol at point. If INTERACTIVE is nil the function acts like a Capf." (interactive (list t)) (if interactive ;; No cycling since it breaks the :exit-function. (let (completion-cycle-threshold) - (cape-interactive #'cape-symbol)) + (cape-interactive #'cape-elisp-symbol)) (pcase-let ((`(,beg . ,end) (cape--bounds 'symbol))) (when (eq (char-after beg) ?') (setq beg (1+ beg) end (max beg end))) |
