diff options
| -rw-r--r-- | README.org | 5 | ||||
| -rw-r--r-- | cape.el | 12 |
2 files changed, 11 insertions, 6 deletions
@@ -43,6 +43,7 @@ backends into Capfs and merge multiple Capfs into a Super-Capf! + ~cape-line~: Complete entire line from file + ~cape-tex~: Complete unicode char from TeX command, e.g. ~\hbar~. + ~cape-sgml~: Complete unicode char from Sgml entity, e.g., ~&alpha~. ++ ~cape-rfc1345~: Complete unicode char using RFC 1345 mnemonics. * Configuration @@ -70,7 +71,8 @@ this package should be upstreamed into Emacs itself. ("C-c p l" . cape-line) ("C-c p w" . cape-dict) ("C-c p \\" . cape-tex) - ("C-c p &" . cape-sgml)) + ("C-c p &" . cape-sgml) + ("C-c p r" . cape-rfc1345)) :init ;; Add `completion-at-point-functions', used by `completion-at-point'. (add-to-list 'completion-at-point-functions #'cape-file) @@ -78,6 +80,7 @@ this package should be upstreamed into Emacs itself. (add-to-list 'completion-at-point-functions #'cape-dabbrev) (add-to-list 'completion-at-point-functions #'cape-keyword) ;;(add-to-list 'completion-at-point-functions #'cape-sgml) + ;;(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-ispell) ;;(add-to-list 'completion-at-point-functions #'cape-dict) @@ -568,9 +568,9 @@ If INTERACTIVE is nil the function acts like a capf." ,(cape--table-with-properties (cape--dict-words) :category 'cape-dict) :exclusive no ,@cape--dict-properties)))) -;;;;; cape-tex and cape-sgml +;;;;; cape-tex, cape-sgml, cape-rfc1345 -(defmacro cape--quail-define (name method prefix) +(defmacro cape--char-define (name method prefix) "Define quail translation variable with NAME. METHOD is the input method. PREFIX is the prefix regular expression." @@ -591,7 +591,7 @@ PREFIX is the prefix regular expression." (buffer-substring-no-properties (point-min) (point-max)))))) (pos 0) (list nil) - (regexp (format "\\(%s[^ \t\n]+\\)[ \t\n]+\\([^ \t\n]+\\)" prefix))) + (regexp (format "\\(?:^\\|[\t\n ]\\)\\(%s[^ \t\n]+\\)[ \t\n]+\\([^ \t\n]+\\)" prefix))) (while (string-match regexp str pos) (let ((char (match-string 2 str)) (name (if (equal method "sgml") @@ -636,8 +636,10 @@ the function acts like a capf." method) ;;;###autoload (autoload 'cape-tex "cape" nil t) ;;;###autoload (autoload 'cape-sgml "cape" nil t) -(cape--quail-define tex "TeX" "[\\\\^_]") -(cape--quail-define sgml "sgml" "&") +;;;###autoload (autoload 'cape-rfc1345 "cape" nil t) +(cape--char-define tex "TeX" "[\\\\^_]") +(cape--char-define sgml "sgml" "&") +(cape--char-define rfc1345 "rfc1345" "&") ;;;;; cape-abbrev |
