comparison lisp/mail/rmail.el @ 22330:6d28f2670ebe

(rmail-toggle-header): Preserve point and window-start (more or less) when reverting to original header.
author Karl Heuer <kwzh@gnu.org>
date Tue, 02 Jun 1998 06:54:40 +0000
parents 150184345dc7
children fbe69401c609
comparison
equal deleted inserted replaced
22329:4786b00d2973 22330:6d28f2670ebe
1778 (defun rmail-toggle-header (&optional arg) 1778 (defun rmail-toggle-header (&optional arg)
1779 "Show original message header if pruned header currently shown, or vice versa. 1779 "Show original message header if pruned header currently shown, or vice versa.
1780 With argument ARG, show the message header pruned if ARG is greater than zero; 1780 With argument ARG, show the message header pruned if ARG is greater than zero;
1781 otherwise, show it in full." 1781 otherwise, show it in full."
1782 (interactive "P") 1782 (interactive "P")
1783 (let* ((buffer-read-only nil) 1783 (save-excursion
1784 (pruned (rmail-msg-is-pruned)) 1784 (let* ((buffer-read-only nil)
1785 (prune (if arg 1785 (pruned (rmail-msg-is-pruned))
1786 (> (prefix-numeric-value arg) 0) 1786 (prune (if arg
1787 (not pruned)))) 1787 (> (prefix-numeric-value arg) 0)
1788 (if (eq pruned prune) 1788 (not pruned))))
1789 t 1789 (if (eq pruned prune)
1790 (rmail-maybe-set-message-counters) 1790 t
1791 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max)) 1791 (rmail-maybe-set-message-counters)
1792 (if pruned 1792 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max))
1793 (progn (goto-char (point-min)) 1793 (if pruned
1794 (forward-line 1) 1794 (let (window-at-top)
1795 (delete-char 1) 1795 (goto-char (point-min))
1796 (insert ?0) 1796 (forward-line 1)
1797 (forward-line 1) 1797 (delete-char 1)
1798 (let ((case-fold-search t)) 1798 (insert ?0)
1799 (while (looking-at "Summary-Line:\\|Mail-From:") 1799 (forward-line 1)
1800 (forward-line 1))) 1800 (let ((case-fold-search t))
1801 (insert "*** EOOH ***\n") 1801 (while (looking-at "Summary-Line:\\|Mail-From:")
1802 (forward-char -1) 1802 (forward-line 1)))
1803 (search-forward "\n*** EOOH ***\n") 1803 (insert "*** EOOH ***\n")
1804 (forward-line -1) 1804 (forward-char -1)
1805 (let ((temp (point))) 1805 (search-forward "\n*** EOOH ***\n")
1806 (and (search-forward "\n\n" nil t) 1806 (forward-line -1)
1807 (delete-region temp (point)))) 1807 (let ((temp (point)))
1808 (goto-char (point-min)) 1808 (when (search-forward "\n\n" nil t)
1809 (search-forward "\n*** EOOH ***\n") 1809 (if (< (window-start) (point))
1810 (narrow-to-region (point) (point-max))) 1810 (setq window-at-top t))
1811 (rmail-reformat-message (point-min) (point-max))) 1811 (delete-region temp (point))))
1812 (rmail-highlight-headers)))) 1812 (goto-char (point-min))
1813 (search-forward "\n*** EOOH ***\n")
1814 (if window-at-top
1815 (set-window-start (selected-window) (point) t))
1816 (narrow-to-region (point) (point-max)))
1817 (rmail-reformat-message (point-min) (point-max)))
1818 (rmail-highlight-headers)))))
1813 1819
1814 ;;;; *** Rmail Attributes and Keywords *** 1820 ;;;; *** Rmail Attributes and Keywords ***
1815 1821
1816 ;; Make a string describing current message's attributes and keywords 1822 ;; Make a string describing current message's attributes and keywords
1817 ;; and set it up as the name of a minor mode 1823 ;; and set it up as the name of a minor mode