From 35c88720df50aba03b5630fa3c5c9271a216c6fe Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 12 Apr 2022 22:39:44 -0500 Subject: Fix requires --- lisp/+ispell.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/+ispell.el b/lisp/+ispell.el index 697233f..fbfc0f0 100644 --- a/lisp/+ispell.el +++ b/lisp/+ispell.el @@ -4,7 +4,8 @@ ;;; Code: -(require 'cl) +(require 'cl-lib) +(require 'seq) ;; Utility function TODO: move elsewhere (defun +ispell-append-removing-duplicates (&rest lists) -- cgit 1.4.1-21-gabe81 From bb756ce658f2e1a4bf904ce19392fed3015d2463 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 12 Apr 2022 22:41:03 -0500 Subject: Dang ol +shr.el file --- lisp/+shr.el | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 lisp/+shr.el (limited to 'lisp') diff --git a/lisp/+shr.el b/lisp/+shr.el new file mode 100644 index 0000000..af4bf5b --- /dev/null +++ b/lisp/+shr.el @@ -0,0 +1,51 @@ +;;; +shr.el --- SHR extras -*- lexical-binding: t; -*- + +;;; Commentary: + +;;; Code: + +;;; [[https://github.com/oantolin/emacs-config/blob/master/my-lisp/shr-heading.el][shr-heading]], by oantolin + +(defun +shr-heading-next (&optional arg) + "Move forward by ARG headings (any h1-h4). +If ARG is negative move backwards, ARG defaults to 1." + (interactive "p") + (unless arg (setq arg 1)) + (catch 'return + (dotimes (_ (abs arg)) + (when (> arg 0) (end-of-line)) + (if-let ((match + (funcall (if (> arg 0) + #'text-property-search-forward + #'text-property-search-backward) + 'face '(shr-h1 shr-h2 shr-h3 shr-h4) + (lambda (tags face) + (cl-loop for x in (if (consp face) face (list face)) + thereis (memq x tags)))))) + (goto-char + (if (> arg 0) (prop-match-beginning match) (prop-match-end match))) + (throw 'return nil)) + (when (< arg 0) (beginning-of-line))) + (beginning-of-line) + (point))) + +(defun +shr-heading-previous (&optional arg) + "Move backward by ARG headings (any h1-h4). +If ARG is negative move forwards instead, ARG defaults to 1." + (interactive "p") + (+shr-heading-next (- (or arg 1)))) + +(defun +shr-heading--line-at-point () + "Return the current line." + (buffer-substring (line-beginning-position) (line-end-position))) + +(defun +shr-heading-setup-imenu () + "Setup imenu for h1-h4 headings in eww buffer. +Add this function to appropriate major mode hooks such as +`eww-mode-hook' or `elfeed-show-mode-hook'." + (setq-local + imenu-prev-index-position-function #'+shr-heading-previous + imenu-extract-index-name-function #'+shr-heading--line-at-point)) + +(provide '+shr) +;;; +shr.el ends here -- cgit 1.4.1-21-gabe81