Function: hrmail--rmail-cease-edit

hrmail--rmail-cease-edit is an interactive and byte-compiled function defined in hrmail.el.

Signature

(hrmail--rmail-cease-edit)

Documentation

Finish editing message; switch back to Rmail proper.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hrmail.el
(defun hrmail--rmail-cease-edit ()
  "Finish editing message; switch back to Rmail proper."
  (interactive)
  ;; Make sure buffer ends with a newline.
  (save-excursion
    (Rmail-msg-widen)
    (goto-char (point-max))
    (if (not (eq (preceding-char) ?\n))
	(insert "\n"))
    ;; Adjust the marker that points to the end of this message.
    (set-marker (aref rmail-message-vector (1+ rmail-current-message))
		(point))
    (hmail:msg-narrow))
  (let ((old rmail-old-text))
    ;; Update the mode line.
    (set-buffer-modified-p (buffer-modified-p))
    (rmail-mode-1)
    (if (and (= (length old) (- (point-max) (point-min)))
	     (string-equal old (buffer-substring (point-min) (point-max))))
	nil
      (setq old nil)
      (rmail-set-attribute "edited" t)
      (if (boundp 'rmail-summary-vector)
	  (progn
	    (aset rmail-summary-vector (1- rmail-current-message) nil)
	    (save-excursion
	      (rmail-widen-to-current-msgbeg
	       (lambda ()
		 (forward-line 2)
		 ;; Delete summary line which may have changed.
		 (if (looking-at "Summary-line: ")
		     (let ((buffer-read-only nil))
		       (delete-region (point)
				      (progn (forward-line 1)
					     (point)))))
		 ;;
		 ;; Update internal copy of subject line, from
		 ;; message subject line, which may have changed.
		 (let ((subject
			(save-excursion
			  (if (re-search-forward "^Subject:" nil t)
			      (progn
				;; Try to find subject in msg header.
				(re-search-forward "^Subject:" nil t)
				(skip-chars-forward " \t")
				(buffer-substring
				 (point) (progn (re-search-forward
						 "\n[^ \t]" nil t)
						(- (point) 2))))))))
		   (if (and subject
			    (search-forward "\n*** EOOH ***\n" nil t))
		       (let ((buffer-read-only nil))
			 (goto-char (match-beginning 0))
			 (if (re-search-backward "^Subject:" nil t)
			     (delete-region (point)
					    (progn (re-search-forward
						    "\n[^ \t]" nil t)
						   (1- (point)))))
			 (beginning-of-line)
			 (insert "Subject: " subject "\n"))))))

	      ;; Adjust the marker that points to the end of this message
	      ;; since editing may have occured above.
	      (goto-char (point-max))
	      (set-marker (aref rmail-message-vector (1+ rmail-current-message))
			  (point))

	      ;; Update summary line for current message, if it exists in the
	      ;; summary buffer.
	      (rmail-summary-update-line rmail-current-message)

	      ;; This may set the current buffer to the summary buffer.
	      (rmail-show-message))))))
  (setq buffer-read-only t))