Use compose-around-builder for imenu-flattening hook

This commit is contained in:
Ivan Malison 2016-08-12 16:36:10 -07:00
parent 8227739cfd
commit 37486ab51f
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -671,14 +671,11 @@ By advising ~imenu--make-index-alist~ with
always flattened. This is still experimental, so copy to your own always flattened. This is still experimental, so copy to your own
dotfiles with caution. dotfiles with caution.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun imalison:flatten-imenu-index-with-function
(index-build-function &rest args)
(imalison:flatten-imenu-index (apply index-build-function args)))
(advice-add 'imenu--make-index-alist (advice-add 'imenu--make-index-alist
:around 'imalison:flatten-imenu-index-with-function) :around (imalison:compose-around-builder
imalison:flatten-imenu-index-with-function
imalison:flatten-imenu-index))
#+END_SRC #+END_SRC
** Add Files to ~org-agenda-files~ ** Add Files to ~org-agenda-files~
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun imalison:add-to-org-agenda-files (incoming-files) (defun imalison:add-to-org-agenda-files (incoming-files)
@ -935,8 +932,10 @@ A macro for composing functions together to build an interactive command to copy
** Compose Around Builder ** Compose Around Builder
For composing functions with an apply so that they can be used with the ~:around~ keyword of advice-add For composing functions with an apply so that they can be used with the ~:around~ keyword of advice-add
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defmacro imalison:compose-around-builder (&rest functions) (defmacro imalison:compose-around-builder-fn (&rest functions)
`(imalison:compose-fn ,@functions 'apply)) `(imalison:compose-fn ,@functions apply))
(imalison:named-builder imalison:compose-around-builder)
#+END_SRC #+END_SRC
** Named Compile ** Named Compile
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp