diff lisp/ffap.el @ 52672:d4d213cfb340

whitespace.el now takes user customizable variable to display cleanliness of files. ffap.el - bugfix.
author Rajesh Vaidheeswarran <rv@gnu.org>
date Mon, 29 Sep 2003 18:05:31 +0000
parents 695cf19ef79e
children 2b7d168d24b4
line wrap: on
line diff
--- a/lisp/ffap.el	Mon Sep 29 15:53:11 2003 +0000
+++ b/lisp/ffap.el	Mon Sep 29 18:05:31 2003 +0000
@@ -65,6 +65,7 @@
 ;; (setq ffap-alist nil)                ; faster, dumber prompting
 ;; (setq ffap-machine-p-known 'accept)  ; no pinging
 ;; (setq ffap-url-regexp nil)           ; disable URL features in ffap
+;; (setq ffap-shell-prompt-regexp nil)  ; disable shell prompt stripping
 ;;
 ;; ffap uses `browse-url' (if found, else `w3-fetch') to fetch URL's.
 ;; For a hairier `ffap-url-fetcher', try ffap-url.el (same ftp site).
@@ -120,6 +121,18 @@
   (let ((sym (intern-soft name)))
     (if (and sym (boundp sym)) (symbol-value sym) default)))
 
+(defcustom ffap-shell-prompt-regexp
+  ;; This used to test for some shell prompts that don't have a space
+  ;; after them. The common root shell prompt (#) is not listed since it
+  ;; also doubles up as a valid URL character.
+  "[$%><]*"
+  "Paths matching this regexp are stripped off the shell prompt
+If nil, ffap doesn't do shell prompt stripping."
+  :type '(choice (const :tag "Disable" nil)
+		  (const :tag "Standard" "[$%><]*")
+		   regexp)
+  :group 'ffap)
+
 (defcustom ffap-ftp-regexp
   ;; This used to test for ange-ftp or efs being present, but it should be
   ;; harmless (and simpler) to give it this value unconditionally.
@@ -1109,6 +1122,11 @@
          ;; Try stripping off line numbers; good for compilation/grep output.
          ((and (not abs) (string-match ":[0-9]" name)
                (ffap-file-exists-string (substring name 0 (match-beginning 0)))))
+         ;; Try stripping off prominent (non-root - #) shell prompts
+	 ;; if the ffap-shell-prompt-regexp is non-nil.
+         ((and ffap-shell-prompt-regexp
+	       (not abs) (string-match ffap-shell-prompt-regexp name)
+               (ffap-file-exists-string (substring name (match-end 0)))))
 	 ;; Immediately test local filenames.  If default-directory is
 	 ;; remote, you probably already have a connection.
 	 ((and (not abs) (ffap-file-exists-string name)))