[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep cannot find relative file names after save and re-open
From: |
Richard M. Stallman |
Subject: |
Re: grep cannot find relative file names after save and re-open |
Date: |
Mon, 22 Aug 2005 01:02:33 -0400 |
I think this change fixes the problems of reading in a saved *grep*
buffer. It might cause problems in some other case for compilation,
but I am not sure what case. If I could tell what that case is,
I could probably fix it.
Can people try it and see what fails?
*** compile.el 20 Aug 2005 17:41:24 -0400 1.375
--- compile.el 22 Aug 2005 00:12:17 -0400
***************
*** 1770,1776 ****
(defun compilation-get-file-structure (file &optional fmt)
"Retrieve FILE's file-structure or create a new one.
! FILE should be (ABSOLUTE-FILENAME) or (RELATIVE-FILENAME . DIRNAME)."
(or (gethash file compilation-locs)
;; File was not previously encountered, at least not in the form passed.
--- 1773,1780 ----
(defun compilation-get-file-structure (file &optional fmt)
"Retrieve FILE's file-structure or create a new one.
! FILE should be (FILENAME) or (RELATIVE-FILENAME . DIRNAME).
! In the former case, FILENAME may be relative or absolute."
(or (gethash file compilation-locs)
;; File was not previously encountered, at least not in the form passed.
***************
*** 1783,1795 ****
;; Check for a comint-file-name-prefix and prepend it if appropriate.
;; (This is very useful for compilation-minor-mode in an rlogin-mode
;; buffer.)
! (if (boundp 'comint-file-name-prefix)
! (if (file-name-absolute-p filename)
! (setq filename
! (concat (with-no-warnings comint-file-name-prefix)
filename))
! (setq default-directory
! (file-truename
! (concat (with-no-warnings comint-file-name-prefix)
default-directory)))))
;; If compilation-parse-errors-filename-function is
;; defined, use it to process the filename.
--- 1787,1799 ----
;; Check for a comint-file-name-prefix and prepend it if appropriate.
;; (This is very useful for compilation-minor-mode in an rlogin-mode
;; buffer.)
! (unless (equal comint-file-name-prefix "")
! (if (file-name-absolute-p filename)
! (setq filename
! (concat comint-file-name-prefix filename))
! (setq default-directory
! (file-truename
! (concat comint-file-name-prefix default-directory)))))
;; If compilation-parse-errors-filename-function is
;; defined, use it to process the filename.
***************
*** 1804,1818 ****
;; the appropriate file. So we look for doubled slashes in the file
;; name and fix them.
(setq filename (command-line-normalize-file-name filename))
-
- ;; Now eliminate any "..", because find-file would get them wrong.
- ;; Make relative and absolute filenames, with or without links, the
- ;; same.
- (setq filename
- (list (abbreviate-file-name
- (file-truename (if (cdr file)
- (expand-file-name filename)
- filename)))))
;; Store it for the possibly unnormalized name
(puthash file
--- 1808,1813 ----