aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey C Honig2011-12-27 14:43:23 -0500
committerJeffrey C Honig2011-12-27 14:43:23 -0500
commit40f1ca7c6c7d2ba7d0ab2a2910af90b73d6ba963 (patch)
tree8acc47f6c488c51aab8a1279ae329930f32c5014
parentc6134398c64c718afbf9fcc62b1efb362853d18d (diff)
downloademacs-40f1ca7c6c7d2ba7d0ab2a2910af90b73d6ba963.tar.gz
emacs-40f1ca7c6c7d2ba7d0ab2a2910af90b73d6ba963.zip
(mh-yank-cur-msg): Replace usage of set-buffer with
with-current-buffer in mh-yang-cur-msg, semantics changed in emacs 23 and we do not want to use set-buffer unless we actually want to change the buffer the user is looking at (cloases SF #2830504).
-rw-r--r--lisp/mh-e/ChangeLog5
-rw-r--r--lisp/mh-e/mh-letter.el128
2 files changed, 70 insertions, 63 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index 499fff67eac..db4c1c56a15 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -10,6 +10,11 @@
10 10
112011-12-27 Jeffrey C Honig <jch@honig.net> 112011-12-27 Jeffrey C Honig <jch@honig.net>
12 12
13 * mh-letter.el (mh-yank-cur-msg): Replace usage of set-buffer with
14 with-current-buffer in mh-yang-cur-msg, semantics changed in emacs
15 23 and we do not want to use set-buffer unless we actually want to
16 change the buffer the user is looking at (cloases SF #2830504).
17
13 * mh-show.el (mh-show-folder-map): Add missing key binding for 18 * mh-show.el (mh-show-folder-map): Add missing key binding for
14 mh-show-pack-folder (closes SF #3466086). 19 mh-show-pack-folder (closes SF #3466086).
15 20
diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el
index f269faf3a51..4f3c6fc0d58 100644
--- a/lisp/mh-e/mh-letter.el
+++ b/lisp/mh-e/mh-letter.el
@@ -723,69 +723,71 @@ not inserted. If the option `mh-yank-behavior' is set to one of
723the supercite flavors, the hook `mail-citation-hook' is ignored 723the supercite flavors, the hook `mail-citation-hook' is ignored
724and `mh-ins-buf-prefix' is not inserted." 724and `mh-ins-buf-prefix' is not inserted."
725 (interactive) 725 (interactive)
726 (if (and mh-sent-from-folder 726 (let ((show-buffer))
727 (with-current-buffer mh-sent-from-folder mh-show-buffer) 727 (if (and mh-sent-from-folder
728 (with-current-buffer mh-sent-from-folder 728 (with-current-buffer mh-sent-from-folder mh-show-buffer)
729 (get-buffer mh-show-buffer)) 729 (setq show-buffer (with-current-buffer mh-sent-from-folder
730 mh-sent-from-msg) 730 (get-buffer mh-show-buffer)))
731 (let ((to-point (point)) 731 mh-sent-from-msg)
732 (to-buffer (current-buffer))) 732 (let ((to-point (point))
733 (set-buffer mh-sent-from-folder) 733 (to-buffer (current-buffer)))
734 (if mh-delete-yanked-msg-window-flag 734 (if mh-delete-yanked-msg-window-flag
735 (delete-windows-on mh-show-buffer)) 735 (with-current-buffer mh-sent-from-folder
736 (set-buffer mh-show-buffer) ; Find displayed message 736 (delete-windows-on show-buffer)))
737 (let* ((from-attr (mh-extract-from-attribution)) 737 ;; Find displayed message
738 (yank-region (mh-mark-active-p nil)) 738 (with-current-buffer show-buffer
739 (mh-ins-str 739 (let* ((from-attr (mh-extract-from-attribution))
740 (cond ((and yank-region 740 (yank-region (mh-mark-active-p nil))
741 (or (eq 'supercite mh-yank-behavior) 741 (mh-ins-str
742 (eq 'autosupercite mh-yank-behavior) 742 (cond ((and yank-region
743 (eq t mh-yank-behavior))) 743 (or (eq 'supercite mh-yank-behavior)
744 ;; supercite needs the full header 744 (eq 'autosupercite mh-yank-behavior)
745 (concat 745 (eq t mh-yank-behavior)))
746 (buffer-substring (point-min) (mh-mail-header-end)) 746 ;; supercite needs the full header
747 "\n" 747 (concat
748 (buffer-substring (region-beginning) (region-end)))) 748 (buffer-substring (point-min) (mh-mail-header-end))
749 (yank-region 749 "\n"
750 (buffer-substring (region-beginning) (region-end))) 750 (buffer-substring (region-beginning) (region-end))))
751 ((or (eq 'body mh-yank-behavior) 751 (yank-region
752 (eq 'attribution mh-yank-behavior) 752 (buffer-substring (region-beginning) (region-end)))
753 (eq 'autoattrib mh-yank-behavior)) 753 ((or (eq 'body mh-yank-behavior)
754 (buffer-substring 754 (eq 'attribution mh-yank-behavior)
755 (save-excursion 755 (eq 'autoattrib mh-yank-behavior))
756 (goto-char (point-min)) 756 (buffer-substring
757 (mh-goto-header-end 1) 757 (save-excursion
758 (point)) 758 (goto-char (point-min))
759 (point-max))) 759 (mh-goto-header-end 1)
760 ((or (eq 'supercite mh-yank-behavior) 760 (point))
761 (eq 'autosupercite mh-yank-behavior) 761 (point-max)))
762 (eq t mh-yank-behavior)) 762 ((or (eq 'supercite mh-yank-behavior)
763 (buffer-substring (point-min) (point-max))) 763 (eq 'autosupercite mh-yank-behavior)
764 (t 764 (eq t mh-yank-behavior))
765 (buffer-substring (point) (point-max)))))) 765 (buffer-substring (point-min) (point-max)))
766 (set-buffer to-buffer) 766 (t
767 (save-restriction 767 (buffer-substring (point) (point-max))))))
768 (narrow-to-region to-point to-point) 768 (with-current-buffer to-buffer
769 (insert (mh-filter-out-non-text mh-ins-str)) 769 (save-restriction
770 (goto-char (point-max)) ;Needed for sc-cite-original 770 (narrow-to-region to-point to-point)
771 (push-mark) ;Needed for sc-cite-original 771 (insert (mh-filter-out-non-text mh-ins-str))
772 (goto-char (point-min)) ;Needed for sc-cite-original 772 (goto-char (point-max)) ;Needed for sc-cite-original
773 (mh-insert-prefix-string mh-ins-buf-prefix) 773 (push-mark) ;Needed for sc-cite-original
774 (when (or (eq 'attribution mh-yank-behavior) 774 (goto-char (point-min)) ;Needed for sc-cite-original
775 (eq 'autoattrib mh-yank-behavior)) 775 (mh-insert-prefix-string mh-ins-buf-prefix)
776 (insert from-attr) 776 (when (or (eq 'attribution mh-yank-behavior)
777 (mh-identity-insert-attribution-verb nil) 777 (eq 'autoattrib mh-yank-behavior))
778 (insert "\n\n")) 778 (insert from-attr)
779 ;; If the user has selected a region, he has already "edited" the 779 (mh-identity-insert-attribution-verb nil)
780 ;; text, so leave the cursor at the end of the yanked text. In 780 (insert "\n\n"))
781 ;; either case, leave a mark at the opposite end of the included 781 ;; If the user has selected a region, he has already "edited" the
782 ;; text to make it easy to jump or delete to the other end of the 782 ;; text, so leave the cursor at the end of the yanked text. In
783 ;; text. 783 ;; either case, leave a mark at the opposite end of the included
784 (push-mark) 784 ;; text to make it easy to jump or delete to the other end of the
785 (goto-char (point-max)) 785 ;; text.
786 (if (null yank-region) 786 (push-mark)
787 (mh-exchange-point-and-mark-preserving-active-mark))))) 787 (goto-char (point-max))
788 (error "There is no current message"))) 788 (if (null yank-region)
789 (mh-exchange-point-and-mark-preserving-active-mark)))))))
790 (error "There is no current message"))))
789 791
790 792
791 793