File: dot.vm-hide-ref-2

package info (click to toggle)
vm 6.75-8
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,932 kB
  • ctags: 1,656
  • sloc: lisp: 24,646; sh: 342; makefile: 265
file content (34 lines) | stat: -rw-r--r-- 1,327 bytes parent folder | download | duplicates (14)
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
Here's a hook function that will hide the References header in
VM's mail-mode buffers.  This is for Good 'Ol Emacs only; this
won't work under XEmacs.  You will notice the cursor behaves as
if the References header is still there... that's because it is
still there.

(defun hide-references-hook ()
  (save-excursion
    (let (lim)
      (goto-char (point-min))
      (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
      (setq lim (match-beginning 0))
      (goto-char (point-min))
      (cond ((re-search-forward "^References:.*\n\\([ \t].*\n\\)*" lim t)
	     (let ((o (make-overlay (match-beginning 0) (match-end 0))))
	       (overlay-put o 'invisible t)))))))

(add-hook 'vm-mail-mode-hook 'hide-references-hook)

Here's the XEmacs version of that function.  Required change was
replacing make-overlay with make-extent, and overlay-put with
set-extent-property.

(defun hide-references-hook ()
  (save-excursion
    (let (lim)
      (goto-char (point-min))
      (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
      (setq lim (match-beginning 0))
      (goto-char (point-min))
      (cond ((re-search-forward "^References:.*\n\\([ \t].*\n\\)*" lim t)
	     (let ((o (make-extent (match-beginning 0) (match-end 0))))
	       (set-extent-property o 'invisible t)))))))