Skip to content

Instantly share code, notes, and snippets.

(let ((org-super-agenda-groups
'((:auto-group t))))
(org-agenda-list))
(defun test-func () (print "test func called"))
(defvar hydra-context-commands '('(emacs-lisp-mode test-func "description")))
(defun hydra-current-context () (assoc major-mode hydra-context-commands))
(print (hydra-current-context))
(defun hydra-run-context-command ()
(interactive)
(--when-let (hydra-current-context)
(cl-multiple-value-bind (command description) it
(funcall command))))

Navigation

Nested Narrowing

Hooks

These hooks are called before and after narrowing and widening operations.

(defvar nn-before-narrow-hook (list) "Called before any nn narrowing operation")
(defvar nn-after-narrow-hook (list) "Called after any nn narrowing operation")
(defvar nn-before-widen-hook (list) "Called before any nn widening operation")
(defvar nn-after-widen-hook (list) "Called after any nn widening operation")
(let ((ele (esxml-query-all "div#booksTitle h1#title > span *" tree))
(date (third ele)))
(s-replace "- " "" date)))
(defun amazon-execute-strategy (strategy)
(loop for (key value) on strategy by 'cddr
collect (list key (value))))
(defun print-plist (a)
(loop for (key value) on a by 'cddr
do (message "key: %s - value: %s" key value)))
(defun merge-plist (first second)
(loop for (key value) on second by 'cddr
do (setq first (plist-put first key value)))
first)
(defun print-plist (a)
(loop for (key value) on a by 'cddr
do (message "key: %s - value: %s" key value)))
(defun merge-plist (first second)
(loop for (key value) on second by 'cddr
do (setq first (plist-put first key value))))
(setq a (list :foo 1 :bar 2))
(defun amazon-book-data (url)
"Return plist of data for book at Amazon URL."
(cl-flet ((field (target-field list)
(cl-loop for li in list
for (field value) = (ignore-errors
(-let (((_ _ (_ _ field) value) li))
(list field value)))
when (equal field target-field)
return (s-trim value))))
(let* ((html (org-web-tools--get-url url))
(cl-loop for li in list
for (field value) = (ignore-errors
(-let (((_ _ (_ _ field) value) li))
(list field value)))
when (equal field target-field)
return (s-trim value))))