home *** CD-ROM | disk | FTP | other *** search
- Organization: Carnegie Mellon, Pittsburgh, PA
- Path: sparky!uunet!cis.ohio-state.edu!news.sei.cmu.edu!fs7.ece.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!jf41+
- Newsgroups: gnu.emacs.help
- Message-ID: <8eRCDdO00VpA4D6Rgt@andrew.cmu.edu>
- Date: Tue, 28 Jul 1992 02:06:33 -0400
- From: "Jonathan R. Ferro" <jf41+@andrew.cmu.edu>
- Subject: 2 Elisp questions
- Lines: 30
-
- In the process of writing some functions that did some file munching I
- wanted to find out if a file had been loaded into an emacs buffer or
- not and came up with this doozy:
-
- (let* ((expanded-name (expand-file-name file))
- (already-found
- ;; ARGH! Can't apply "or" over truth-values because it's a
- ;; special form. Have to convert back and forth from tv's
- ;; to ints so "logior" can be used. Grrn.
- (= 1 (apply 'logior
- (mapcar '(lambda (buf)
- (if (string-equal (buffer-file-name buf)
- expanded-name)
- 1 0))
- (buffer-list))))))
- ...
-
- 1. Is there a better way to find out if a file is being visited?
- Did I miss a function in the manual?
- Should I consider "remember length of (buffer-list), find the file,
- see if length changed"?
-
- 2. Is there REALLY no built-in function that you can apply to a list of
- t's and nil's to get their collective AND or OR? I eventually broke
- down and wrote my own, but this is surprising.
-
- --
- Jon Ferro MIT Transportation Modelling Research Center (TMRC)
- jf41+@andrew.cmu.edu "We can hack it!"
- SGNTR VRS VRSN 3.1B: Strppd nd cmprssd fr qckr trnsmssn! nfct yrs tdy!
-