forked from colonelpanic/dotfiles
[Emacs] Add functions section to highlights
This commit is contained in:
parent
80607467a1
commit
c8eec96f6a
@ -8,6 +8,11 @@ others may find to be useful.
|
||||
** Highlights
|
||||
These sections are the ones that have the most potential to be interesting to
|
||||
others:
|
||||
*** [[Functions][My functions section]]
|
||||
...has a bunch of generally useful functions:
|
||||
+ [[downloadfile][Download a file into a buffer]] (curl straight into a file)
|
||||
+ [[editscript][Edit a script on $PATH]]
|
||||
+ [[namedbuild][Named Build of Builder Macros]] and [[composemacros][A Compose Supporting Macros]]
|
||||
*** Configuration of My Own Packages
|
||||
- [[term-projectile][term-projectile]] and [[term-manager][term-manager]]
|
||||
- [[org-projectile][org-projectile]]
|
||||
@ -377,8 +382,8 @@ This is disabled for now until I figure out what to do with emit.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package request)
|
||||
#+END_SRC
|
||||
** Macros
|
||||
*** Named Build
|
||||
** Named Build
|
||||
<<namedbuild>>
|
||||
imalison:named-build provides a way to invoke a macro in such a way
|
||||
that the lambda that it produces is given a name.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -409,7 +414,7 @@ new macro name and the -fn suffix.
|
||||
`(imalison:named-builder-builder
|
||||
,name ,(intern (concat (symbol-name name) "-fn"))))
|
||||
#+END_SRC
|
||||
*** Emacs Version Predicate
|
||||
** Emacs Version Predicate
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defmacro imalison:emacs-version-predicate-fn (major-version minor-version)
|
||||
`(lambda ()
|
||||
@ -422,8 +427,9 @@ new macro name and the -fn suffix.
|
||||
|
||||
(imalison:named-builder imalison:emacs-version-predicate)
|
||||
#+END_SRC
|
||||
*** Compose Functions
|
||||
**** A version supporting macros
|
||||
** Compose Functions
|
||||
*** A version supporting macros
|
||||
<<composemacros>>
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun imalison:help-function-arglist (fn)
|
||||
(let ((result (help-function-arglist fn)))
|
||||
@ -465,7 +471,7 @@ new macro name and the -fn suffix.
|
||||
(imalison:named-builder imalison:compose)
|
||||
(imalison:named-builder imalison:compose-macro)
|
||||
#+END_SRC
|
||||
**** Arbitrary arguments at every step
|
||||
*** Arbitrary arguments at every step
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun imalison:make-list (thing)
|
||||
(if (listp thing)
|
||||
@ -484,7 +490,7 @@ new macro name and the -fn suffix.
|
||||
`(apply ,(car funcs)
|
||||
(imalison:make-list (imalison:compose-with-apply-helper ,(cdr funcs))))))
|
||||
#+END_SRC
|
||||
**** Simpler unary version
|
||||
*** Simpler unary version
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defmacro imalison:compose-unary (&rest funcs)
|
||||
"Build a new function with NAME that is the composition of FUNCS."
|
||||
@ -497,7 +503,7 @@ new macro name and the -fn suffix.
|
||||
'arg
|
||||
`(funcall ,(car funcs) (imalison:compose-helper-unary ,(cdr funcs)))))
|
||||
#+END_SRC
|
||||
*** Make Interactive
|
||||
** Make Interactive
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defmacro imalison:make-interactive-fn (function)
|
||||
`(lambda (&rest args)
|
||||
@ -506,7 +512,7 @@ new macro name and the -fn suffix.
|
||||
|
||||
(imalison:named-builder imalison:make-interactive)
|
||||
#+END_SRC
|
||||
*** Advice Add Around Builder
|
||||
** Advice Add Around Builder
|
||||
For composing functions with an apply so that they can be used with
|
||||
the ~:around~ keyword of advice-add.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -516,11 +522,11 @@ the ~:around~ keyword of advice-add.
|
||||
|
||||
(imalison:named-builder imalison:advice-add-around-builder)
|
||||
#+END_SRC
|
||||
**** Kill New
|
||||
*** Kill New
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(imalison:advice-add-around-builder imalison:kill-new-around kill-new)
|
||||
#+END_SRC
|
||||
*** Let Around
|
||||
** Let Around
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defmacro imalison:let-around-fn (orig-func &rest forms)
|
||||
(let* ((orig-interactive-form (interactive-form orig-func))
|
||||
@ -535,7 +541,7 @@ the ~:around~ keyword of advice-add.
|
||||
|
||||
(imalison:named-builder imalison:let-around)
|
||||
#+END_SRC
|
||||
*** Let Around Advice
|
||||
** Let Around Advice
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defmacro imalison:let-advise-around-fn (&rest forms)
|
||||
`(lambda (orig-func &rest args)
|
||||
@ -544,7 +550,7 @@ the ~:around~ keyword of advice-add.
|
||||
|
||||
(imalison:named-builder imalison:let-advise-around)
|
||||
#+END_SRC
|
||||
*** 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.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; TODO/XXX: Isn't this just apply? why doesn't apply work here
|
||||
@ -556,7 +562,7 @@ the ~:around~ keyword of advice-add.
|
||||
|
||||
(imalison:named-builder imalison:compose-around-builder)
|
||||
#+END_SRC
|
||||
*** Measure Time
|
||||
** Measure Time
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defmacro imalison:measure-time (&rest body)
|
||||
"Measure and return the running time of the code block."
|
||||
@ -747,6 +753,7 @@ A macro for composing functions together to build an interactive command to copy
|
||||
(perform-replace "\\n" "\n" nil nil delimited nil nil beg end nil)))))
|
||||
#+END_SRC
|
||||
** Download a File Into a Buffer
|
||||
<<downloadfile>>
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun imalison:download-to-buffer (uri)
|
||||
(interactive (list (read-string "Enter uri: ")))
|
||||
@ -770,6 +777,9 @@ A macro for composing functions together to build an interactive command to copy
|
||||
(intern (mapconcat 'imalison:maybe-symbol-name args "")))
|
||||
#+END_SRC
|
||||
** Edit a script on PATH
|
||||
<<editscript>> Note that you'll need to make sure that emacs properly inherits
|
||||
the path variable for this work. Check out my [[exec-path-from-shell]] config for
|
||||
details.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun imalison:get-executables-at-path (filepath)
|
||||
(when (and (file-exists-p filepath) (f-directory? filepath))
|
||||
|
Loading…
Reference in New Issue
Block a user