Skip to content

Commit

Permalink
First attempt at implementing #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Iqbal Ansari committed Nov 19, 2015
1 parent 553303d commit 1e52e86
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions emojify.el
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,11 @@ mark the start and end of region containing the text."
(when display
(list 'display display))))

(defvar emojify-emoji-keymap (let ((map (make-sparse-keymap)))
(define-key map (kbd "C-d") #'emojify-delete-emoji-forward)
(define-key map (kbd "DEL") #'emojify-delete-emoji-backward)
map))

(defmacro emojify-with-saved-buffer-state (&rest forms)
"Execute FORMS saving current buffer state.
Expand Down Expand Up @@ -593,6 +598,7 @@ TODO: Skip emojifying if region is already emojified."
'emojify-text match
'emojify-start match-beginning
'emojify-end match-end
'keymap emojify-emoji-keymap
'point-entered #'emojify-point-entered-function
'help-echo #'emojify-help-function)))))))))))

Expand Down Expand Up @@ -628,10 +634,21 @@ BEG and END are the beginning and end of the region respectively"
'emojify-text t
'emojify-start t
'emojify-end t
'keymap t
'help-echo t))))
;; Setup the next iteration
(setq beg emoji-end)))))

(defun emojify-delete-emoji-forward ()
(interactive)
(delete-region (get-text-property (point) 'emojify-start)
(get-text-property (point) 'emojify-end)))

(defun emojify-delete-emoji-backward ()
(interactive)
(delete-region (get-text-property (1- (point)) 'emojify-start)
(get-text-property (1- (point)) 'emojify-end)))

(defun emojify-redisplay-emojis (&optional beg end)
"Redisplay emojis in region between BEG and END.
Expand Down

0 comments on commit 1e52e86

Please sign in to comment.