[Emacs] Fix eros mode advice so values are always returned

This commit is contained in:
Ivan Malison 2016-12-31 14:19:06 -08:00
parent df58c8dfac
commit b79d1f3faf
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -1656,7 +1656,9 @@ https://github.com/alpaker/Fill-Column-Indicator/issues/21 for more details
(defun imalison:set-highlight-indent-guides-faces (&rest args) (defun imalison:set-highlight-indent-guides-faces (&rest args)
(interactive) (interactive)
(require 'highlight-indent-guides)
(let ((bg-color (face-background 'default))) (let ((bg-color (face-background 'default)))
(when bg-color
(set-face-background 'highlight-indent-guides-odd-face (set-face-background 'highlight-indent-guides-odd-face
(imalison:modify-hsv (imalison:modify-hsv
bg-color bg-color
@ -1666,19 +1668,10 @@ https://github.com/alpaker/Fill-Column-Indicator/issues/21 for more details
(imalison:modify-hsv (imalison:modify-hsv
bg-color bg-color
(imalison:build-safe-change-hsv-value (imalison:build-safe-change-hsv-value
imalison:hsv-value-delta))))) imalison:hsv-value-delta))))))
;; XXX: This hacks around the fact that (face-background 'default) is nil at
;; the time of load-theme
(defun imalison:set-highlight-indent-guides-faces-load-theme (&rest args)
(if (face-background 'default)
(progn
(require 'highlight-indent-guides)
(imalison:set-highlight-indent-guides-faces))
(run-at-time "1 sec" nil 'imalison:set-highlight-indent-guides-faces-load-theme)))
(advice-add 'load-theme (advice-add 'load-theme
:after 'imalison:set-highlight-indent-guides-faces-load-theme) :after 'imalison:set-highlight-indent-guides-faces)
(add-hook 'prog-mode-hook 'highlight-indent-guides-mode)) (add-hook 'prog-mode-hook 'highlight-indent-guides-mode))
:config :config
@ -2512,15 +2505,22 @@ Reduce indentation for some functions
(advice-add 'eval-last-sexp :around 'eros-around-eval-last-sexp)) (advice-add 'eval-last-sexp :around 'eros-around-eval-last-sexp))
:preface :preface
(progn (progn
(defvar eros-mode nil)
(defun eros-around-eval-last-sexp (fn &rest args) (defun eros-around-eval-last-sexp (fn &rest args)
(eros--eval-overlay (apply fn args) (point))) (let ((result (apply fn args)))
(when eros-mode
(eros--eval-overlay result (point)))
result))
(defun eros-around-eval-defun (fn &rest args) (defun eros-around-eval-defun (fn &rest args)
(let ((result (apply fn args)))
(when eros-mode
(eros--eval-overlay (eros--eval-overlay
(apply fn args) result
(save-excursion (save-excursion
(end-of-defun) (end-of-defun)
(point)))) (point))))
result))
(add-hook 'emacs-lisp-mode-hook 'eros-mode))) (add-hook 'emacs-lisp-mode-hook 'eros-mode)))
#+END_SRC #+END_SRC