Thread View: gnu.epoch.misc
2 messages
2 total messages
Started by Robb Nebbe
Wed, 10 Jun 1992 08:54
How do I get rid of "Mail"
Author: Robb Nebbe
Date: Wed, 10 Jun 1992 08:54
Date: Wed, 10 Jun 1992 08:54
10 lines
1007 bytes
1007 bytes
I've modified my mode line but I haven't been able to figure out how to get rid of the " Mail" that is at the end of the display-time-string (which is generated by the display-time function?) I already have enough things in my environment telling me when I have mail or what ever the "Mail" is trying to tell me. Does anyone have a fix for this? Thanks in advance. Robb Nebbe nebbe@lglsun.epfl.ch
Re: How do I get rid of "Mail"
Author: Mark D. Baushke
Date: Wed, 10 Jun 1992 03:13
Date: Wed, 10 Jun 1992 03:13
308 lines
11543 bytes
11543 bytes
On 10 Jun 92 08:54:39 GMT, nebbe@lglsun.epfl.ch (Robb Nebbe) said:
Robb> I've modified my mode line but I haven't been able to figure out how to
Robb> get rid of the " Mail" that is at the end of the display-time-string
Robb> (which is generated by the display-time function?) I already have enough
Robb> things in my environment telling me when I have mail or what ever the
Robb> "Mail" is trying to tell me.
Robb> Does anyone have a fix for this? Thanks in advance.
Robb> Robb Nebbe
Robb> nebbe@lglsun.epfl.ch
You may find the following replacement for time.el to be useful. Save
it into a file called my-time.el somewhere in your load-path and put
the following into your ~/.emacs file:
(setq display-no-mail t)
(require 'my-time)
Enjoy!
-- Mark
mdb@nsd.3com.com
;; modified for use in 18.56 by Roland McGrath
;; added display-no-mail flag by Mark D. Baushke for use by Robb Nebbe
;Date: 19 May 89 16:25:10 GMT
;From: "Mark D. Baushke" <apple!oliveb!3comvax!bridge2!mdb@BBN.COM>
;Sender: arpa-unix-emacs-request@BBN.COM
;Subject: full-featured version of time.el (was Re: display-time)
;References: <24576@agate.BERKELEY.EDU>, <40157@bbn.COM>
;Organization: 3Com Corp., Mountain View, CA.
;Source-Info: From (or Sender) name not authenticated.
;
;In article <40157@bbn.COM> jr@bbn.com (John Robinson) writes:
;>In article <24576@agate.BERKELEY.EDU>, alanw@django (Alan Weinstein) writes:
;>>Is it possible to eliminate the "load" information from the status
;>>line when display-time is invoked?
;>
;>display-time simply runs the program `loadst'. Normally, this
;>resolves to /usr/local/emacs/etc/loadst, but if your exec-path
;>variable has a directory earlier than that one that contains an
;>executable loadst, it will be used instead. So you can modify
;>loadst.c to make a private version, or better yet, simply make it the
;>shellscript:
;>
;>while true
;>do date +%r
;> sleep $2
;>done
;
;Alternatively, you can modify time.el to do what you want. I did this
;starting back in 1987 and have kept it up with each version since.
;
;The following is a 'full featured' (maybe too many?) version of
;time.el which I am currently running under GNU Emacs 18.51. It should
;work with 18.54 with no problems since time.el has not changed between
;18.51 and 18.54.
;
;Features of interest:
;
; * Provides a hook to 'beep' on new mail arrival.
;
; * load information can be suppressed completely. A zero load
; 0.00[0] is always supressed
;
; * time can be suppressed (only the Mail flag will be displayed)
;
; * A simple timer mechanism can tell you to 'go home' at a
; particular time each day or may be used as a reminder
; service by setting display-gohome-time like
;
; (setq display-gohome-time '(
; ("Wed" 1115 "Dentist Appt." 2030)
; ("Thu" 1845 "Pick up kids" 2030)
; ))
;
;I find it quite handy. Just remember to load it from you ~/.emacs
;before your (display-time).
;
;N.B.: This code should probably use the save-match-data stuff recently
;posted, but I don't have time to add that right now. Feel free to do so.
;
;Improvements welcome.
;
;Enjoy!
;--
;Mark D. Baushke
;UUCP: {3comvax,auspex,sun}!bridge2!mdb
;Nameserver: mdb@bridge2.ESD.3Com.COM
;;;;;;;;;;;;;;;;;;;;;;;;;;; -*- Mode: Emacs-Lisp -*- ;;;;;;;;;;;;;;;;;;;;;;;;;;
;; my-time.el --- modified 18.51 time.el
;;
;; Author : Mark D. Baushke
;; Created On : Sep 15, 1987
;; Last Modified By: Mark D. Baushke
;; Last Modified On: Thu Mar 9 09:38:28 1989
;; Update Count : 2
;; Status : OK.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Display time and load in mode line of Emacs.
;; Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY. No author or distributor
;; accepts responsibility to anyone for the consequences of using it
;; or for whether it serves any particular purpose or works at all,
;; unless he says so in writing. Refer to the GNU Emacs General Public
;; License for full details.
;; Everyone is granted permission to copy, modify and redistribute
;; GNU Emacs, but only under the conditions described in the
;; GNU Emacs General Public License. A copy of this license is
;; supposed to have been given to you along with GNU Emacs so you
;; can know your rights and responsibilities. It should be in a
;; file named COPYING. Among other things, the copyright notice
;; and this notice must be preserved on all copies.
;; A version of time that gets rid of the insignificant parts of the
;; display-time line "[0]", as well as the 0.00 if the load is that
;; low. Optionally, setting the variables 'display-newmail-beep will
;; print a message when it first notices that mail has arrived. Using
;; display-mail-only will get rid of all load and time information,
;; just prints the "Mail" flag when you have some.
(defvar display-time-process nil)
(defvar display-time-no-load nil
"*If non-NIL, do not display any load information.")
(defvar display-no-mail nil
"*If non-NIL, do not display Mail flag at any time.")
(defvar display-mail-only nil
"*Only print the Mail flag not the time or load.")
(defvar display-newmail-beep nil
"*Print a message when new mail first arrives.")
(defvar display-gohome-msg "Go Home"
"*Add this message to the display-time-string when display-gohome-time.")
(defvar display-gohome-time nil
"*Add the display-gohome-msg to the display-time-string.
The value of the variable may be a number or string representing military time
(e.g., 1800 is 6pm, if it is a string it may optionally have a ':'
between the hours and the minutes). Or it may be an association list
between the 'day of the week', 'military time', and optional
gohome-msg of the form:
(setq display-gohome-time '((\"Mon\" 1900) (\"Tue\" 1830 \"Tue meeting\")))
Which would print the Go Home message only on Monday at 7pm and
Tuesday at 6:30pm.")
(defvar display-time-interval 60
"*Seconds between updates of time in the mode line.")
(defvar display-time-string nil)
(defun display-time ()
"Display current time and load level in mode line of each buffer.
Updates automatically every minute.
If display-time-day-and-date is non-nil, the current day and date
are displayed as well."
(interactive)
(let ((live (and display-time-process
(eq (process-status display-time-process) 'run))))
(if (not live)
(progn
(if display-time-process
(delete-process display-time-process))
(or global-mode-string (setq global-mode-string '("")))
(or (memq 'display-time-string global-mode-string)
(setq global-mode-string
(append global-mode-string '(display-time-string))))
(setq display-time-string "")
(setq display-time-process
(start-process "display-time" nil
"wakeup"
(int-to-string display-time-interval)))
(process-kill-without-query display-time-process)
(set-process-sentinel display-time-process 'display-time-sentinel)
(set-process-filter display-time-process 'display-time-filter)))))
(defun display-time-sentinel (proc reason)
(or (eq (process-status proc) 'run)
(setq display-time-string ""))
;; Force mode-line updates
(save-excursion (set-buffer (other-buffer)))
(set-buffer-modified-p (buffer-modified-p))
(sit-for 0))
(defun military-time (mil-string)
(if (not (stringp mil-string))
mil-string
(if (string-match ":" mil-string)
(string-to-int
(concat (substring mil-string 0 (match-beginning 0))
(substring mil-string (1+ (match-beginning 0)))))
(string-to-int mil-string))))
(defun display-time-filter (proc string)
(setq display-time-string
(mapconcat (function (lambda (s)
(if s
(concat s " ")
nil)))
(list
(if (and display-mail-only
(null display-gohome-time))
nil
(let ((time (current-time-string))
hour pm)
(concat
(if display-gohome-time
(let ((gohome-time (military-time
display-gohome-time))
(right-now
(string-to-int
(concat (substring (current-time-string)
11 13)
(substring (current-time-string)
14 16))))
(msg display-gohome-msg)
stop-time)
(if (listp display-gohome-time)
(let ((elt (assoc
(substring
(current-time-string) 0 3)
display-gohome-time)))
(setq gohome-time (nth 1 elt)
msg (nth 2 elt)
stop-time (nth 3 elt))
(if (not (stringp msg))
(setq msg display-gohome-msg))
(if (stringp gohome-time)
(setq gohome-time
(military-time gohome-time)))
(if (not stop-time)
(setq stop-time 2400))
))
(if (numberp gohome-time)
(cond ((= gohome-time right-now)
(message "Time to leave!")
(beep t)
(concat "*** " msg " *** "))
((and (< gohome-time right-now)
(>= stop-time right-now))
(concat msg " "))))))
(or display-mail-only
(progn
(setq hour (read (substring time 11 13))
pm (>= hour 12))
(if (> hour 12)
(setq hour (- hour 12))
(if (= hour 0)
(setq hour 12)))
(format "%s%d:%s%s"
(if display-time-day-and-date
(concat (substring time 0 11) " ")
"")
hour (substring time 14 16)
(if pm "pm" "am")))))))
(and (not display-time-no-load)
(not display-mail-only)
(let ((load (condition-case ()
(car (load-average))
(error 0))))
(if (= load 0)
""
(format "%d.%02d" (/ load 100) (% load 100)))))
(if (not display-no-mail)
(let ((mail-spool-file (concat rmail-spool-directory
(or (getenv "LOGNAME")
(getenv "USER")
(user-login-name)))))
(if (and (file-exists-p mail-spool-file)
;; file not empty?
(> (nth 7 (file-attributes mail-spool-file)) 0))
(prog1 "Mail"
(and display-newmail-beep
(not
(let ((data (match-data)))
(unwind-protect
(string-match "Mail"
display-time-string)
(store-match-data data))))
(progn
(message "You have mail waiting...")
(beep t))))
""))))
""))
;; Force redisplay of all buffers' mode lines to be considered.
(save-excursion (set-buffer (other-buffer)))
(set-buffer-modified-p (buffer-modified-p))
;; Do redisplay right now, if no input pending.
(sit-for 0))
(provide 'my-time)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads