unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 6b4da6dc7e60e053a68e89d9af6ec1f6b2bb8893 1300 bytes (raw)
name: notmuch-coolj.el 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 
(defgroup notmuch-coolj nil
  "Automatic wrapping of long lines when displaying notmuch articles."
  :group 'notmuch)

(defcustom notmuch-coolj-prefix-regexp " *\\(>+ +\\)?"
  "A regexp matching potential line prefixes.")

(defun notmuch-coolj-wrap-region (beg end)
  "Wrap lines in the region."
  (goto-char beg)
  (forward-line -1)
  (while (not (>= (point) end))
    (notmuch-coolj-wrap-line)
    (forward-line)))

(defun notmuch-coolj-wrap-line ()
  "Wrap the current line, if necessary."
  (let ((prefix (notmuch-coolj-determine-prefix))
	(start (point))
	(end (make-marker))
	(width (window-width)))
    (set-marker end (save-excursion (end-of-line) (point)))
    (while (> end (+ (point) width))
      (forward-char (window-width))
      (if (re-search-backward "[^ ]\\( \\)" start t)
	  (progn
	    (goto-char (match-beginning 1))
	    (insert-before-markers ?\n)
	    (re-search-forward "\\( +\\)[^ ]" nil t)
	    (delete-region (match-beginning 1) (match-end 1))
	    (backward-char 1)
	    (insert-before-markers prefix)))
      (beginning-of-line))))

(defun notmuch-coolj-determine-prefix ()
  "Determine the prefix for the current line."
  (if (looking-at notmuch-coolj-prefix-regexp)
      (buffer-substring-no-properties (match-beginning 0) (match-end 0))))

(provide 'notmuch-coolj)

debug log:

solving 6b4da6d ...
found 6b4da6d in https://yhetil.org/notmuch/87hbph5yww.fsf@aw.hh.sledj.net/

applying [1/1] https://yhetil.org/notmuch/87hbph5yww.fsf@aw.hh.sledj.net/
diff --git a/notmuch-coolj.el b/notmuch-coolj.el
new file mode 100644
index 0000000..6b4da6d

Checking patch notmuch-coolj.el...
Applied patch notmuch-coolj.el cleanly.

index at:
100644 6b4da6dc7e60e053a68e89d9af6ec1f6b2bb8893	notmuch-coolj.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).