[comp.emacs] GNU Emacs, display-time, and mh-e

jack@hpindda.HP.COM (Jack Repenning) (11/09/87)

Here's a small mod I made to mh-e.el, so that the "Mail" sentinel in the
mode line (posted by display-time, in time.el) gets cleared when mail
is mh-inc'ed.  (For ease of reading, I'll point out that the new code
is added as the last form in mh-get-new-mail.)

Does anyone have a better solution, or a critique of this one?

Jack Repenning		(HP-UX: jack@hpda, (Telnet and PacTel:) 447-3380, 43LN)
Information Networks Division, 43LN
Hewlett Packard Company
19420 Homestead Road
Cupertino, CA  95014

2,4d1
< ;;;	Modified by Jack Repenning (jack@hpda.hp.com) to clear the
< ;;;		"Mail" flag in the mode line, if display-time is
< ;;;		running
1081c1078
< (defun mh-get-new-mail (maildrop-name) ;;; Adds "clear display-time flag"
---
> (defun mh-get-new-mail (maildrop-name)
1120,1126c1117,1118
< 	     t))))
<   (if (and (boundp 'display-time-process) display-time-process)
<       (start-process "update-time-display" nil
< 		     "/bin/sh"
< 		     "-c" (concat "kill -14 "
< 				  (int-to-string
< 				   (process-id display-time-process))))
---
> 	     t)))))
> 

jack@hpindda.HP.COM (Jack Repenning) (11/11/87)

I've been informed that the code in the basenote doesn't compile
(mismatched parentheses).  Sorry about that!  Here's correct code.

I was asked for a context diff, but I can't provide that - my diff
hasn't got that feature.  Here's something nearly equivalent:
unchanged code is presented unchanged, changed regions are delimited
by "vvv" and "^^^", and presented just as diff normally presents them.
I present the one modified function in its entirety.

Jack Repenning

vvv
< (defun mh-get-new-mail (maildrop-name)
---
> (defun mh-get-new-mail (maildrop-name) ;;; Adds "clear display-time flag"
^^^
  "Read new mail from a maildrop into the current buffer.
Return t if there was new mail, nil otherwise.  Return in the current buffer."
  (let ((buffer-read-only nil)
	(point-before-inc (point)))
    (message (if maildrop-name
		 (format "inc %s -file %s..." (buffer-name) maildrop-name)
		 (format "inc %s..." (buffer-name))))
    (mh-unmark-all-headers nil)
    (setq mh-next-direction 'forward)
    (flush-lines "^inc:\\|^scan:")	; Kill old error messages
    (goto-char (point-max))
    (let ((start-of-inc (point)))
      (if maildrop-name
	  (mh-exec-cmd-output "inc" nil (buffer-name) "-file"
			      (expand-file-name maildrop-name)
			      "-truncate")
	  (mh-exec-cmd-output "inc" nil))
      (message
       (if maildrop-name
	   (format "inc %s -file %s...done" (buffer-name) maildrop-name)
	   (format "inc %s...done" (buffer-name))))
      (goto-char start-of-inc)
      (cond ((looking-at "inc: no mail")
	     (keep-lines "^[ ]*[0-9]")	; Flush random scan lines
	     (mh-make-folder-mode-line)
	     (goto-char point-before-inc)
	     (message "No new mail%s%s." (if maildrop-name " in " "")
		      (if maildrop-name maildrop-name ""))
	     nil)
	    ((looking-at "inc:")	; Error messages
	     (mh-make-folder-mode-line)
	     (goto-char point-before-inc)
	     (message "inc error")
	     nil)
	    (t
	     (keep-lines "^[ ]*[0-9]")
	     (mh-make-folder-mode-line)
	     (mh-goto-cur-msg)
vvv
< 	     t)))))
< 
---
> 	     t))))
>   (if (and (boundp 'display-time-process) display-time-process)
>       (start-process "update-time-display" nil
> 		     "/bin/sh"
> 		     "-c" (concat "kill -14 "
> 				  (int-to-string
> 				   (process-id display-time-process))))))
> ;;; End of mh-get-new-mail
^^^