lisp-find-file returns the wrong buffer, plus M-. aside

Bob Rogers <[email protected]>
Newsgroups gmane.lisp.ilisp.devel
Message-ID <[email protected]>
   Hello, it's me again.  While perusing the describe function in both
CMUCL and SBCL, I noticed that lisp-find-file as called from
lisp-locate-definition sometimes gets the definition in the wrong file.
This is because by default lisp-find-file looks through the list of
buffers for a match on only the file-name-nondirectory, so whichever
buffer you've visited most recently wins, even if it's the wrong one.
When I rip out the code that implements this misfeature, the resulting
lisp-find-file definition (appended) is almost trivial.  It also becomes
possible to use find-file-noselect in lieu of the nonexistent
lisp-find-file-noselect.

   The original lisp-find-file code sets and uses the lisp-buffer-file
variable, but (it seems to me) in a rather pointless way, so I didn't
bother to preserve it.  As a result of this change, the following lines
in ilisp-def.el are no longer needed:

    (defvar lisp-buffer-file nil 
      "Cons of buffer-file-name and the expanded name.")

    (make-variable-buffer-local 'lisp-buffer-file)

It seems that no other ilisp code uses this variable.

   In case it isn't yet obvious, I'm in the midst of a quest to make
M-. more robust and featureful, in general but also particularly in
CMUCL, which seems to be somewhat lacking in that respect.  I'm an old
Lisp Machine hacker, so my "code surfing" standards are probably pretty
high.  (I'm also currently unemployed, and this seemed like a productive
way to procrastinate.)  In another few weeks, I expect the code should
be well enough along to publish as a patch, though not yet ready for
incorporating into ilisp directly.  (It will be big, and not fully
backward compatible, so a "public comment" period would be appropriate
in any case.)

					-- Bob Rogers
					   http://rgrjr.dyndns.org/

------------------------------------------------------------------------
(defun lisp-find-file (file &optional pop no-name)
  "Find FILE, optionally POPping.
The optional NO-NAME arg is obsolete."
  ;; [Formerly, if NO-NAME is nil and there is a buffer with a name that is the
  ;; same as the final pathname component, lisp-find-file selected that buffer
  ;; instead of reading the file associated with the full path name.  This
  ;; feature was used only by edit-definitions-lisp (via lisp-locate-definition)
  ;; and replace-lisp, where it may have helped for remote lisps without shared
  ;; file access, but only if you happen not to have duplicate file names.  In
  ;; the 21st century, remote file access is more common; by the same token, so
  ;; are duplicate file names.  -- rgr, 26-Aug-02.]
  (if pop
      (lisp-pop-to-buffer (find-file-noselect file))
      (find-file file)))


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.