commit 78c4358da5f271667bfddc51c7b2b75830b2c7d2
parent 596884d9476ecb839e5431f83702e4c4a4e1c6d2
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date: Sun, 15 Nov 2015 16:09:47 +0530
Rename emojify-emoji-style to emojify-emoji-styles
Diffstat:
4 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/README.org b/README.org
@@ -76,9 +76,9 @@
*** Configuring the types of emojis displayed
Emojify by default displays plain text emojis (~:)~), unicode emojis (~😄~)
and github style emojis ~:smile:~. However this is customizable. You can do
- so by changing the value of ~emojify-emoji-style~ using the customize
+ so by changing the value of ~emojify-emoji-styles~ using the customize
interface. To change the value of the variable from Lisp using the function
- ~emojify-set-emoji-style~ (or set it before loading ~emojify~), call it with
+ ~emojify-set-emoji-styles~ (or set it before loading ~emojify~), call it with
one parameter the list of styles that you want to be displayed. The possible
styles are
diff --git a/emojify.el b/emojify.el
@@ -201,7 +201,7 @@ can customize `emojify-inhibit-major-modes' and
(json-read-file emojify-emoji-json)))
(ht-reject! (lambda (_key value)
- (not (memq (intern (ht-get value "style")) emojify-emoji-style)))
+ (not (memq (intern (ht-get value "style")) emojify-emoji-styles)))
emojify-emojis)
(setq emojify-regexps (when (ht-keys emojify-emojis)
@@ -209,11 +209,15 @@ can customize `emojify-inhibit-major-modes' and
(regexp-opt emojis)))))
;;;###autoload
-(defun emojify-set-emoji-style (styles)
+(defun emojify-set-emoji-styles (styles)
"Set the type of emojis that should be displayed.
-VALUE is the value to be used as preferred style, see `emojify-emoji-style'"
- (setq-default emojify-emoji-style styles)
+VALUE is the value to be used as preferred style, see `emojify-emoji-styles'"
+ (when (not (listp styles))
+ (setq styles (list styles))
+ (warn "`emojify-emoji-style' has been deprecated use `emojify-emoji-styles' instead!"))
+
+ (setq-default emojify-emoji-styles styles)
;; Update emoji data
(emojify-set-emoji-data)
@@ -223,8 +227,7 @@ VALUE is the value to be used as preferred style, see `emojify-emoji-style'"
(when emojify-mode
(emojify-redisplay-emojis))))
-;; TODO: Make this a list
-(defcustom emojify-emoji-style
+(defcustom emojify-emoji-styles
'(ascii unicode github)
"The type of emojis that should be displayed.
@@ -237,9 +240,13 @@ These can have one of the following values
(const :tag "Display only ascii emojis" ascii)
(const :tag "Display only github emojis" github)
(const :tag "Display only unicode codepoints" unicode))
- :set (lambda (_ value) (emojify-set-emoji-style value))
+ :set (lambda (_ value) (emojify-set-emoji-styles value))
:group 'emojify)
+;; Obsolete vars
+(define-obsolete-variable-alias 'emojify-emoji-style 'emojify-emoji-styles "0.2")
+(define-obsolete-function-alias 'emojify-set-emoji-style 'emojify-set-emoji-styles "0.2")
+
(defcustom emojify-prog-contexts
'both
"Contexts where emojis can be displayed in programming modes.
diff --git a/test/emojify-test.el b/test/emojify-test.el
@@ -98,27 +98,27 @@
(unicode-emoji-pos (+ (point-min) (length ":) ")))
(github-emoji-pos (+ (point-min) (length ":) 😄 "))))
- (emojify-set-emoji-style '(ascii))
+ (emojify-set-emoji-styles '(ascii))
(emojify-tests-should-be-emojified ascii-emoji-pos)
(emojify-tests-should-not-be-emojified unicode-emoji-pos)
(emojify-tests-should-not-be-emojified github-emoji-pos)
- (emojify-set-emoji-style '(unicode))
+ (emojify-set-emoji-styles '(unicode))
(emojify-tests-should-not-be-emojified ascii-emoji-pos)
(emojify-tests-should-be-emojified unicode-emoji-pos)
(emojify-tests-should-not-be-emojified github-emoji-pos)
- (emojify-set-emoji-style '(github))
+ (emojify-set-emoji-styles '(github))
(emojify-tests-should-not-be-emojified ascii-emoji-pos)
(emojify-tests-should-not-be-emojified unicode-emoji-pos)
(emojify-tests-should-be-emojified github-emoji-pos)
- (emojify-set-emoji-style '(ascii unicode github))
+ (emojify-set-emoji-styles '(ascii unicode github))
(emojify-tests-should-be-emojified ascii-emoji-pos)
(emojify-tests-should-be-emojified unicode-emoji-pos)
(emojify-tests-should-be-emojified github-emoji-pos)
- (emojify-set-emoji-style nil)
+ (emojify-set-emoji-styles nil)
(emojify-tests-should-not-be-emojified ascii-emoji-pos)
(emojify-tests-should-not-be-emojified unicode-emoji-pos)
(emojify-tests-should-not-be-emojified github-emoji-pos))))
diff --git a/test/test-helper.el b/test/test-helper.el
@@ -36,7 +36,7 @@ Helps isolate tests from each other's customizations."
(emojify-saved-display-style emojify-display-style)
(emojify-saved-inhibit-major-modes emojify-inhibit-major-modes)
(emojify-saved-inhibit-in-buffer-functions emojify-inhibit-in-buffer-functions)
- (emojify-saved-emoji-style emojify-emoji-style)
+ (emojify-saved-emoji-style emojify-emoji-styles)
(emojify-saved-prog-contexts emojify-prog-contexts)
(emojify-saved-inhibit-functions emojify-inhibit-functions)
(emojify-saved-point-entered-behaviour emojify-point-entered-behaviour)
@@ -55,7 +55,7 @@ Helps isolate tests from each other's customizations."
emojify-show-help emojify-saved-show-help)
;; This as a side-effect also re-reads JSON data so no need to
;; re-adjust changes to emojify-emoji-json
- (emojify-set-emoji-style emojify-saved-emoji-style))))
+ (emojify-set-emoji-styles emojify-saved-emoji-style))))
(defmacro emojify-tests-with-emojified-buffer (str &rest forms)
(declare (indent 1))