gaynor@topaz.rutgers.edu (Silver) (09/14/87)
Between testing and posting, I thought I would clean the code up a little. In doing so, I broke it. The changes were, I thought, relatively trivial, and so I did not retest it as thoroughly as I did originally. You may have found that it will appear to work properly for a moment, but... As the code is fairly short, here it is again - use this stuff instead of the old. Comments preceded by ;;;;;;;;;;. ;; Set up mode-line, by making mode-line-buffer-identification local ;; to every buffer. A find-file-hook abbreviates the buffer-file-name ;; to something a little easier to read. ;; ;; file name, originally = buffer-file-name ;; abbreviations = file-name-abbreviation-alist ;; means of abbreviation = string-replace-regexp-alist ;; find-file-hook = abbreviate-mode-line-buffer-identification ;;;;;;;;;; Make sure you use mode-line-buffer-identification to ;;;;;;;;;; identify the buffer in your mode-line-format. This ;;;;;;;;;; variable must be buffer-local (if it is not already). ;;;;;;;;;; Otherwise, the rest of the stuff is up to you - I've ;;;;;;;;;; included my stuff to keep things in perspective. ;; Customize mode-line-format and it's constituents. Remember, ;; mode-line-buffer-identification must be used to identify the ;; buffer. mode-line-modified is retained because it is in emacs's ;; own default mode-line-format, and emacs might do some clever ;; tricks with it. (make-variable-buffer-local 'mode-line-buffer-identification) ;;;;;;;;;; The next line was not present in the original. I don't ;;;;;;;;;; think it matters a whole lot (it should already be ;;;;;;;;;; buffer-local, I think), but just in case... (make-variable-buffer-local 'mode-line-modified) (setq-default mode-line-buffer-identification '("%b")) (setq-default mode-line-modified '("--%*%*--")) ;;;;;;;;;; I originally had a typo here, an extra `default'. (setq-default mode-line-format '("----Emacs: " mode-line-buffer-identification mode-line-modified "%[(" mode-name minor-mode-alist "%n" mode-line-process ")%]----%p%-")) ;; Replace leading instances of "/u2/gaynor" and embedded instances of ;; "u2/gaynor" with "~". (defvar file-name-abbreviation-alist '(("\\(^/\\|\\)u2/gaynor" . "~")) "Alist of embedded filename patterns vs corresponding abbreviations. Each element is of the form (<regexp> . <to-string>) (see replace-regexp).") ;;;;;;;;;; Let's say that I often played with the files in ;;;;;;;;;; /u2/luser/foobar/bletch. Then I might want to replace ;;;;;;;;;; leading instances of this path with "bletch" by including ;;;;;;;;;; the association ("^/u2/luser/foobar/bletch" . "bletch"). ;;;;;;;;;; ;;;;;;;;;; Let's say that I wanted to display only the last directory ;;;;;;;;;; in the path. In this case, I would add the association ;;;;;;;;;; ("^.*/\\([^/]*/\\)" . "\\1"). ;;;;;;;;;; The bug. This baby should have originally be enclosed in a ;;;;;;;;;; save-excursion. I didn't think it necessary, because I ;;;;;;;;;; killed the temp buffer at the end, and so thought that the ;;;;;;;;;; buffer for local-variable-affecting operations would be the ;;;;;;;;;; default. Instead, I think that they were taking place ;;;;;;;;;; in this killed buffer, or to the globals. (??) (defun string-replace-regexp-alist (s al) "Given a string s, replace each instance of regexp (cars of elements in al) with to-string (cdrs of elements in al) as per replace-regexp." (save-excursion (let (tal ss) ;; Have to use a temporary buffer to pull this one off... (set-buffer (get-buffer-create "!@#$%^&*")) (insert s) ;; Walk down al with tal, regexp-replacing instances of ;; (car (car tal)) with (cdr (car tal)). (setq tal al) (while tal (goto-char (point-min)) (replace-regexp (car (car tal)) (cdr (car tal))) (setq tal (cdr tal))) (setq ss (buffer-string)) (kill-buffer "!@#$%^&*") ss))) (defun abbreviate-mode-line-buffer-identification () "Abbreviates mode-line-buffer-identification locally, as per string-replace-regexp-alist and file-name-abbreviation-alist." (setq mode-line-buffer-identification (list (string-replace-regexp-alist buffer-file-name file-name-abbreviation-alist)))) ;;;;;;;;;; Add abbreviate-mode-line-buffer-identification to ;;;;;;;;;; find-file-hooks. (setq find-file-hooks '(abbreviate-mode-line-buffer-identification)) I humbly beg pardon, Silver. M-x device-open Open device: mouth M-x device-insert Insert: foot Andy Gaynor 201-545-0458 81 Hassart St, New Brunswick, NJ 08901 gaynor@topaz.rutgers.edu ...!rutgers!topaz.rutgers.edu!gaynor "There is no editor but Emacs, and Lisp is its prophet."
ado@CC2.BBN.COM (Buz Owen) (09/15/87)
Here's an update on this bug: Either we didn't run Binkeley and newtest on our machine yet, or David Abe, who was going to do it, didn't tell me the result yet. However, I have some new data on this bug. 1) Tom Blackadar and others had suggested to me that I was having switch contention problems, and that running "toset 2000" might help. It tried this and it makes no difference. 2) we swapped the hanging processor on our machine with a processor in another slot. The bug moved to the new slot. This normally indicates a hardware problem, but keep reading. 3) When the problem occurs, the node is STILL UP. You can run processes on it from other nodes. However, the processes never complete. Instead, they hang after producing all their output. 4) Curious about this and the fact that "lf" and "showmem" hang, I looked at the code of the latter two a little bit. I concluded that they were stuck in "For_All_Objects" looking at objects on the node in question. I wrote a test program that just called For_All_Objects and printed the oid. It turns out that For_All_Objects correctly passes a few oids correctly, and then gets stuck looping on a single object. So the program prints a few oids, and then starts printing the same oid over and over. This is strongly indicative of a software bug, not a hardware bug. For the moment, I am just getting the node into the system cluster and keeping it out of general use.
gaynor@TOPAZ.RUTGERS.EDU (Silver) (09/15/87)
> Here's an update on this bug:
Are we talking about the same bug? If we are, I would like more
information on it. If not, no problem.
;;;;;;;;;; The bug. This baby should have originally be enclosed in a
;;;;;;;;;; save-excursion. I didn't think it necessary, because I
;;;;;;;;;; killed the temp buffer at the end, and so thought that the
;;;;;;;;;; buffer for local-variable-affecting operations would be the
;;;;;;;;;; default. Instead, I think that they were taking place
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;;;;;;;;;; in this killed buffer, or to the globals. (??)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(defun string-replace-regexp-alist (s al)
"Given a string s, replace each instance of regexp (cars of elements
in al) with to-string (cdrs of elements in al) as per replace-regexp."
(save-excursion
(let (tal ss)
;; Have to use a temporary buffer to pull this one off...
(set-buffer (get-buffer-create "!@#$%^&*"))
(insert s)
;; Walk down al with tal, regexp-replacing instances of
;; (car (car tal)) with (cdr (car tal)).
(setq tal al)
(while tal
(goto-char (point-min))
(replace-regexp (car (car tal)) (cdr (car tal)))
(setq tal (cdr tal)))
(setq ss (buffer-string))
(kill-buffer "!@#$%^&*")
ss)))
Silver.
Andy Gaynor 201-545-0458 81 Hassart St, New Brunswick, NJ 08901
gaynor@topaz.rutgers.edu ...!rutgers!topaz.rutgers.edu!gaynor