summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2023-09-10 07:17:01 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2023-09-10 07:17:01 +0200
commit4589365f3786aff8c23e5ccb5de1af08990a3e28 (patch)
tree8100fc748b2b267ccade7392eb196158d0b2e0a1
parentb3eb9a8a696c710b51399991a49639f1f8acb584 (diff)
Add cape-emoji on Emacs 28 and newer (See #90)
-rw-r--r--CHANGELOG.org4
-rw-r--r--cape-char.el15
2 files changed, 16 insertions, 3 deletions
diff --git a/CHANGELOG.org b/CHANGELOG.org
index 3f45ca1..4113302 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -4,7 +4,9 @@
* Development
-- Add =cape-wrap-debug= and =cape-capf-debug= to add debug messages to a Capf.
+- =cape-emoji=: New Capf available on Emacs 28 and newer.
+- =cape-wrap-debug=, =cape-capf-debug=: New Capf transformers to add debug messages
+ to a Capf.
- Rename =cape-super-capf= to =cape-capf-super=. Add =cape-wrap-super= for consistency
with other Capf combinators.
- Rename =cape-symbol= to =cape-elisp-symbol=.
diff --git a/cape-char.el b/cape-char.el
index b7eb367..d8571d7 100644
--- a/cape-char.el
+++ b/cape-char.el
@@ -130,12 +130,23 @@ is nil the function acts like a capf." method method)
(cape--table-with-properties ,hash :category ',capf))
,properties)))))))
+;; TODO: use static-if as soon as compat-30 is released
+(defmacro cape--static-if (cond then &rest else)
+ "Static if COND with THEN and ELSE branch."
+ (if (eval cond t) then (cons 'progn else)))
+
;;;###autoload (autoload 'cape-tex "cape-char" nil t)
-;;;###autoload (autoload 'cape-sgml "cape-char" nil t)
-;;;###autoload (autoload 'cape-rfc1345 "cape-char" nil t)
(cape-char--define tex "TeX" ?\\ ?^ ?_)
+
+;;;###autoload (autoload 'cape-sgml "cape-char" nil t)
(cape-char--define sgml "sgml" ?&)
+
+;;;###autoload (autoload 'cape-rfc1345 "cape-char" nil t)
(cape-char--define rfc1345 "rfc1345" ?&)
+;;;###autoload (when (> emacs-major-version 28) (autoload 'cape-emoji "cape-char" nil t))
+(cape--static-if (> emacs-major-version 28)
+ (cape-char--define emoji "emoji" ?:))
+
(provide 'cape-char)
;;; cape-char.el ends here