Skip to content

Instantly share code, notes, and snippets.

@hanabokuro
Created December 29, 2018 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanabokuro/a4c37bb02b8eeaf8ead53961aed59262 to your computer and use it in GitHub Desktop.
Save hanabokuro/a4c37bb02b8eeaf8ead53961aed59262 to your computer and use it in GitHub Desktop.
egg-make-bunsetsu for emacs 26
(defun egg-make-bunsetsu (backend bunsetsu last)
(let* ((converted (copy-sequence (egg-get-bunsetsu-converted bunsetsu)))
(language (egg-get-converted-language bunsetsu))
(continue (and (null last) (egg-major-bunsetsu-continue-p bunsetsu)))
(face (egg-get-conversion-face language))
len len1 prev-pos)
(setq len1 (length converted))
(or (eq last t)
(setq converted (concat converted
(if continue
egg-conversion-minor-separator
egg-conversion-major-separator))))
(setq len (length converted))
(egg-remove-all-text-properties 0 len converted)
(cursor-sensor-mode)
(add-text-properties 0 len
(list 'read-only t
(egg-bunsetsu-info) bunsetsu
'egg-backend backend
'egg-lang language
'egg-bunsetsu-last last
'egg-major-continue continue
'cursor-sensor-functions '((lambda (window pos event)
(egg-enter/leave-fence)))
'modification-hooks '(egg-modify-fence))
converted)
(if face
(egg-set-face 0 len1 face converted))
converted))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment