Remove outdate comment section in woman.el. See bug #12099.
[bpt/emacs.git] / lisp / ffap.el
index f766fef..3d1f402 100644 (file)
@@ -1,7 +1,6 @@
 ;;; ffap.el --- find file (or url) at point
 
-;; Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005,
-;;   2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+;; Copyright (C) 1995-1997, 2000-2012  Free Software Foundation, Inc.
 
 ;; Author: Michelangelo Grigni <mic@mathcs.emory.edu>
 ;; Maintainer: FSF
 \f
 ;;; Code:
 
+(require 'url-parse)
+
 (define-obsolete-variable-alias 'ffap-version 'emacs-version "23.2")
 
 (defgroup ffap nil
   ;; 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
+  "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.
-  "\\`/[^/:]+:"
+(defcustom ffap-ftp-regexp "\\`/[^/:]+:"
   "File names matching this regexp are treated as remote ffap.
 If nil, ffap neither recognizes nor generates such names."
   :type '(choice (const :tag "Disable" nil)
@@ -149,15 +147,20 @@ If nil, ffap neither recognizes nor generates such names."
   :group 'ffap)
 
 (defcustom ffap-url-unwrap-local t
-  "If non-nil, convert `file:' URL to local file name before prompting."
+  "If non-nil, convert some URLs to local file names before prompting.
+Only \"file:\" and \"ftp:\" URLs are converted, and only if they
+do not specify a host, or the host is either \"localhost\" or
+equal to `system-name'."
   :type 'boolean
   :group 'ffap)
 
-(defcustom ffap-url-unwrap-remote t
-  "If non-nil, convert `ftp:' URL to remote file name before prompting.
-This is ignored if `ffap-ftp-regexp' is nil."
-  :type 'boolean
-  :group 'ffap)
+(defcustom ffap-url-unwrap-remote '("ftp")
+  "If non-nil, convert URLs to remote file names before prompting.
+If the value is a list of strings, that specifies a list of URL
+schemes (e.g. \"ftp\"); in that case, only convert those URLs."
+  :type '(choice (repeat string) boolean)
+  :group 'ffap
+  :version "24.2")
 
 (defcustom ffap-ftp-default-user "anonymous"
   "User name in ftp file names generated by `ffap-host-to-path'.
@@ -184,7 +187,7 @@ Note this name may be omitted if it equals the default
    "\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\)://" ; needs host
    "\\)."                              ; require one more character
    )
-   "Regexp matching URL's.  nil to disable URL features in ffap.")
+   "Regexp matching URLs.  Use nil to disable URL features in ffap.")
 
 (defcustom ffap-foo-at-bar-prefix "mailto"
   "Presumed URL prefix type of strings like \"<foo.9z@bar>\".
@@ -248,14 +251,14 @@ ffap most of the time."
 (defcustom ffap-file-finder 'find-file
   "The command called by `find-file-at-point' to find a file."
   :type 'function
-  :group 'ffap)
-(put 'ffap-file-finder 'risky-local-variable t)
+  :group 'ffap
+  :risky t)
 
 (defcustom ffap-directory-finder 'dired
   "The command called by `dired-at-point' to find a directory."
   :type 'function
-  :group 'ffap)
-(put 'ffap-directory-finder 'risky-local-variable t)
+  :group 'ffap
+  :risky t)
 
 (defcustom ffap-url-fetcher
   (if (fboundp 'browse-url)
@@ -272,8 +275,28 @@ For a fancy alternative, get `ffap-url.el'."
                 (const browse-url-netscape)
                 (const browse-url-mosaic)
                 function)
+  :group 'ffap
+  :risky t)
+
+(defcustom ffap-next-regexp
+  ;; If you want ffap-next to find URL's only, try this:
+  ;; (and ffap-url-regexp (string-match "\\\\`" ffap-url-regexp)
+  ;;     (concat "\\<" (substring ffap-url-regexp 2))))
+  ;;
+  ;; It pays to put a big fancy regexp here, since ffap-guesser is
+  ;; much more time-consuming than regexp searching:
+  "[/:.~[:alpha:]]/\\|@[[:alpha:]][-[:alnum:]]*\\."
+  "Regular expression governing movements of `ffap-next'."
+  :type 'regexp
   :group 'ffap)
-(put 'ffap-url-fetcher 'risky-local-variable t)
+
+(defcustom dired-at-point-require-prefix nil
+  "If non-nil, reverse the prefix argument to `dired-at-point'.
+This is nil so neophytes notice FFAP.  Experts may prefer to
+disable FFAP most of the time."
+  :type 'boolean
+  :group 'ffap
+  :version "20.3")
 
 \f
 ;;; Compatibility:
@@ -294,18 +317,6 @@ For a fancy alternative, get `ffap-url.el'."
 ;; then, broke it up into ffap-next-guess (noninteractive) and
 ;; ffap-next (a command).  It now work on files as well as url's.
 
-(defcustom ffap-next-regexp
-  ;; If you want ffap-next to find URL's only, try this:
-  ;; (and ffap-url-regexp (string-match "\\\\`" ffap-url-regexp)
-  ;;     (concat "\\<" (substring ffap-url-regexp 2))))
-  ;;
-  ;; It pays to put a big fancy regexp here, since ffap-guesser is
-  ;; much more time-consuming than regexp searching:
-  "[/:.~[:alpha:]]/\\|@[[:alpha:]][-[:alnum:]]*\\."
-  "Regular expression governing movements of `ffap-next'."
-  :type 'regexp
-  :group 'ffap)
-
 (defvar ffap-next-guess nil
   "Last value returned by `ffap-next-guess'.")
 
@@ -524,7 +535,7 @@ The optional NOMODIFY argument suppresses the extra search."
   ;; (ffap-file-remote-p "/ffap.el:80")
   (or (and ffap-ftp-regexp
           (string-match ffap-ftp-regexp filename)
-          ;; Convert "/host.com://dir" to "/host:/dir", to handle a dieing
+          ;; Convert "/host.com://dir" to "/host:/dir", to handle a dying
           ;; practice of advertising ftp files as "host.dom://filename".
           (if (string-match "//" filename)
               ;; (replace-match "/" nil nil filename)
@@ -600,35 +611,52 @@ Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"."
      ret)))
 
 (defsubst ffap-url-p (string)
-  "If STRING looks like an url, return it (maybe improved), else nil."
+  "If STRING looks like an URL, return it (maybe improved), else nil."
   (let ((case-fold-search t))
     (and ffap-url-regexp (string-match ffap-url-regexp string)
         ;; I lied, no improvement:
         string)))
 
 ;; Broke these out of ffap-fixup-url, for use of ffap-url package.
-(defsubst ffap-url-unwrap-local (url)
-  "Return URL as a local file, or nil.  Ignores `ffap-url-regexp'."
-  (and (string-match "\\`\\(file\\|ftp\\):/?\\([^/]\\|\\'\\)" url)
-       (substring url (1+ (match-end 1)))))
-(defsubst ffap-url-unwrap-remote (url)
-  "Return URL as a remote file, or nil.  Ignores `ffap-url-regexp'."
-  (and (string-match "\\`\\(ftp\\|file\\)://\\([^:/]+\\):?\\(/.*\\)" url)
-       (concat
-       (ffap-host-to-filename (substring url (match-beginning 2) (match-end 2)))
-       (substring url (match-beginning 3) (match-end 3)))))
-;; Test: (ffap-url-unwrap-remote "ftp://foo.com/bar.boz")
+(defun ffap-url-unwrap-local (url)
+  "Return URL as a local file name, or nil."
+  (let* ((obj (url-generic-parse-url url))
+        (host (url-host obj))
+        (filename (car (url-path-and-query obj))))
+    (when (and (member (url-type obj) '("ftp" "file"))
+              (member host `("" "localhost" ,(system-name))))
+      ;; On Windows, "file:///C:/foo" should unwrap to "C:/foo"
+      (if (and (memq system-type '(ms-dos windows-nt cygwin))
+              (string-match "\\`/[a-zA-Z]:" filename))
+         (substring filename 1)
+       filename))))
+
+(defun ffap-url-unwrap-remote (url)
+  "Return URL as a remote file name, or nil."
+  (let* ((obj    (url-generic-parse-url url))
+        (scheme (url-type obj))
+        (valid-schemes (if (listp ffap-url-unwrap-remote)
+                           ffap-url-unwrap-remote
+                         '("ftp")))
+        (host (url-host obj))
+        (port (url-port-if-non-default obj))
+        (user (url-user obj))
+        (filename (car (url-path-and-query obj))))
+    (when (and (member scheme valid-schemes)
+              (string-match "\\`[a-zA-Z][-a-zA-Z0-9+.]*\\'" scheme)
+              (not (equal host "")))
+      (concat "/" scheme ":"
+             (if user (concat user "@"))
+             host
+             (if port (concat "#" (number-to-string port)))
+             ":" filename))))
 
 (defun ffap-fixup-url (url)
   "Clean up URL and return it, maybe as a file name."
   (cond
    ((not (stringp url)) nil)
-   ((and ffap-url-unwrap-local (ffap-url-unwrap-local url)))
-   ((and ffap-url-unwrap-remote ffap-ftp-regexp
-        (ffap-url-unwrap-remote url)))
-   ;; All this seems to do is remove any trailing "#anchor" part (Bug#898).
-;;;   ((fboundp 'url-normalize-url)    ; may autoload url (part of w3)
-;;;    (url-normalize-url url))
+   ((and ffap-url-unwrap-local  (ffap-url-unwrap-local url)))
+   ((and ffap-url-unwrap-remote (ffap-url-unwrap-remote url)))
    (url)))
 
 \f
@@ -681,7 +709,7 @@ Uses `path-separator' to separate the path into substrings."
     (nreverse ret)))
 
 (defun ffap-all-subdirs (dir &optional depth)
-  "Return list all subdirectories under DIR, starting with itself.
+  "Return list of all subdirectories under DIR, starting with itself.
 Directories beginning with \".\" are ignored, and directory symlinks
 are listed but never searched (to avoid loops).
 Optional DEPTH limits search depth."
@@ -794,12 +822,12 @@ This uses `ffap-file-exists-string', which may try adding suffixes from
     (dired-mode . ffap-dired)          ; maybe in a subdirectory
     )
   "Alist of \(KEY . FUNCTION\) pairs parsed by `ffap-file-at-point'.
-If string NAME at point (maybe \"\") is not a file or url, these pairs
+If string NAME at point (maybe \"\") is not a file or URL, these pairs
 specify actions to try creating such a string.  A pair matches if either
   KEY is a symbol, and it equals `major-mode', or
-  KEY is a string, it should matches NAME as a regexp.
+  KEY is a string, it should match NAME as a regexp.
 On a match, \(FUNCTION NAME\) is called and should return a file, an
-url, or nil. If nil, search the alist for further matches.")
+URL, or nil.  If nil, search the alist for further matches.")
 
 (put 'ffap-alist 'risky-local-variable t)
 
@@ -851,9 +879,24 @@ url, or nil. If nil, search the alist for further matches.")
   (and (not (string-match "\\.el\\'" name))
        (ffap-locate-file name '(".el") load-path)))
 
+;; FIXME this duplicates the logic of Man-header-file-path.
+;; There should be a single central variable or function for this.
+;; See also (bug#10702):
+;; cc-search-directories, semantic-c-dependency-system-include-path,
+;; semantic-gcc-setup
 (defvar ffap-c-path
-  ;; Need smarter defaults here!  Suggestions welcome.
-  '("/usr/include" "/usr/local/include"))
+  (let ((arch (with-temp-buffer
+                (when (eq 0 (ignore-errors
+                              (call-process "gcc" nil '(t nil) nil
+                                            "-print-multiarch")))
+                  (goto-char (point-min))
+                  (buffer-substring (point) (line-end-position)))))
+        (base '("/usr/include" "/usr/local/include")))
+    (if (zerop (length arch))
+        base
+      (append base (list (expand-file-name arch "/usr/include")))))
+  "List of directories to search for include files.")
+
 (defun ffap-c-mode (name)
   (ffap-locate-file name t ffap-c-path))
 
@@ -864,7 +907,7 @@ url, or nil. If nil, search the alist for further matches.")
 
 (defvar ffap-tex-path
   t                            ; delayed initialization
-  "Path where `ffap-tex-mode' looks for tex files.
+  "Path where `ffap-tex-mode' looks for TeX files.
 If t, `ffap-tex-init' will initialize this when needed.")
 
 (defun ffap-tex-init ()
@@ -1057,51 +1100,46 @@ Assumes the buffer has not changed."
 (declare-function w3-view-this-url "ext:w3" (&optional no-show))
 
 (defun ffap-url-at-point ()
-  "Return url from around point if it exists, or nil."
+  "Return URL from around point if it exists, or nil."
   ;; Could use w3's url-get-url-at-point instead.  Both handle "URL:",
   ;; ignore non-relative links, trim punctuation.  The other will
   ;; actually look back if point is in whitespace, but I would rather
   ;; ffap be less aggressive in such situations.
-  (and
-   ffap-url-regexp
-   (or
-    ;; In a w3 buffer button?
-    (and (eq major-mode 'w3-mode)
-        ;; interface recommended by wmperry:
-        (w3-view-this-url t))
-    ;; Is there a reason not to strip trailing colon?
-    (let ((name (ffap-string-at-point 'url)))
-      (cond
-       ((string-match "^url:" name) (setq name (substring name 4)))
-       ((and (string-match "\\`[^:</>@]+@[^:</>@]+[[:alnum:]]\\'" name)
-            ;; "foo@bar": could be "mailto" or "news" (a Message-ID).
-            ;; Without "<>" it must be "mailto".  Otherwise could be
-            ;; either, so consult `ffap-foo-at-bar-prefix'.
-            (let ((prefix (if (and (equal (ffap-string-around) "<>")
-                                   ;; Expect some odd characters:
-                                   (string-match "[$.0-9].*[$.0-9].*@" name))
-                              ;; Could be news:
-                              ffap-foo-at-bar-prefix
-                            "mailto")))
-              (and prefix (setq name (concat prefix ":" name))))))
-       ((ffap-newsgroup-p name) (setq name (concat "news:" name)))
-       ((and (string-match "\\`[[:alnum:]]+\\'" name) ; <mic> <root> <nobody>
-            (equal (ffap-string-around) "<>")
-            ;; (ffap-user-p name):
-            (not (string-match "~" (expand-file-name (concat "~" name))))
-            )
-       (setq name (concat "mailto:" name)))
-       )
-      (and (ffap-url-p name) name)
-      ))))
+  (when ffap-url-regexp
+    (or (and (eq major-mode 'w3-mode) ; In a w3 buffer button?
+            (w3-view-this-url t))
+       ;; Is there a reason not to strip trailing colon?
+       (let ((name (ffap-string-at-point 'url)))
+         (cond
+          ((string-match "^url:" name) (setq name (substring name 4)))
+          ((and (string-match "\\`[^:</>@]+@[^:</>@]+[[:alnum:]]\\'" name)
+                ;; "foo@bar": could be "mailto" or "news" (a Message-ID).
+                ;; Without "<>" it must be "mailto".  Otherwise could be
+                ;; either, so consult `ffap-foo-at-bar-prefix'.
+                (let ((prefix (if (and (equal (ffap-string-around) "<>")
+                                       ;; Expect some odd characters:
+                                       (string-match "[$.0-9].*[$.0-9].*@" name))
+                                  ;; Could be news:
+                                  ffap-foo-at-bar-prefix
+                                "mailto")))
+                  (and prefix (setq name (concat prefix ":" name))))))
+          ((ffap-newsgroup-p name) (setq name (concat "news:" name)))
+          ((and (string-match "\\`[[:alnum:]]+\\'" name) ; <mic> <root> <nobody>
+                (equal (ffap-string-around) "<>")
+                ;;     (ffap-user-p name):
+                (not (string-match "~" (expand-file-name (concat "~" name)))))
+           (setq name (concat "mailto:" name))))
+
+         (if (ffap-url-p name)
+             name)))))
 
 (defvar ffap-gopher-regexp
   "^.*\\<\\(Type\\|Name\\|Path\\|Host\\|Port\\) *= *\\(.*\\) *$"
-  "Regexp Matching a line in a gopher bookmark (maybe indented).
+  "Regexp matching a line in a gopher bookmark (maybe indented).
 The two subexpressions are the KEY and VALUE.")
 
 (defun ffap-gopher-at-point ()
-  "If point is inside a gopher bookmark block, return its url."
+  "If point is inside a gopher bookmark block, return its URL."
   ;; `gopher-parse-bookmark' from gopher.el is not so robust
   (save-excursion
     (beginning-of-line)
@@ -1144,7 +1182,7 @@ That is, ffap just prepends \"/\".  Set to nil to disable.")
   "Return filename from around point if it exists, or nil.
 Existence test is skipped for names that look remote.
 If the filename is not obvious, it also tries `ffap-alist',
-which may actually result in an url rather than a filename."
+which may actually result in an URL rather than a filename."
   ;; Note: this function does not need to look for url's, just
   ;; filenames.  On the other hand, it is responsible for converting
   ;; a pseudo-url "site.com://dir" to an ftp file name
@@ -1260,7 +1298,7 @@ which may actually result in an url rather than a filename."
 ;; contents before attempting to complete filenames.
 
 (defun ffap-read-file-or-url (prompt guess)
-  "Read file or url from minibuffer, with PROMPT and initial GUESS."
+  "Read file or URL from minibuffer, with PROMPT and initial GUESS."
   (or guess (setq guess default-directory))
   (let (dir)
     ;; Tricky: guess may have or be a local directory, like "w3/w3.elc"
@@ -1302,7 +1340,7 @@ which may actually result in an url rather than a filename."
     guess))
 
 (defun ffap-read-url-internal (string pred action)
-  "Complete url's from history, treating given string as valid."
+  "Complete URLs from history, treating given string as valid."
   (let ((hist (ffap-symbol-value 'url-global-history-hash-table)))
     (cond
      ((not action)
@@ -1326,24 +1364,8 @@ which may actually result in an url rather than a filename."
 ;; We must inform complete about whether our completion function
 ;; will do filename style completion.
 
-(defun ffap-complete-as-file-p ()
-  ;; Will `minibuffer-completion-table' complete the minibuffer
-  ;; contents as a filename?  Assumes the minibuffer is current.
-  ;; Note: t and non-nil mean somewhat different reasons.
-  (if (eq minibuffer-completion-table 'ffap-read-file-or-url-internal)
-      (not (ffap-url-p (buffer-string))) ; t
-    (and minibuffer-completing-file-name '(t)))) ;list
-
-(and
- (featurep 'complete)
- (if (boundp 'PC-completion-as-file-name-predicate)
-     ;; modern version of complete.el, just set the variable:
-     (setq PC-completion-as-file-name-predicate 'ffap-complete-as-file-p)))
-
 \f
 ;;; Highlighting (`ffap-highlight'):
-;;
-;; Based on overlay highlighting in Emacs 19.28 isearch.el.
 
 (defvar ffap-highlight t
   "If non-nil, ffap highlights the current buffer substring.")
@@ -1457,10 +1479,12 @@ and the functions `ffap-file-at-point' and `ffap-url-at-point'."
 \f
 ;;; Menu support (`ffap-menu'):
 
-(defvar ffap-menu-regexp nil
-  "*If non-nil, overrides `ffap-next-regexp' during `ffap-menu'.
+(defcustom ffap-menu-regexp nil
+  "If non-nil, regexp overriding `ffap-next-regexp' in `ffap-menu'.
 Make this more restrictive for faster menu building.
-For example, try \":/\" for URL (and some ftp) references.")
+For example, try \":/\" for URL (and some ftp) references."
+  :type '(choice (const nil) regexp)
+  :group 'ffap)
 
 (defvar ffap-menu-alist nil
   "Buffer local cache of menu presented by `ffap-menu'.")
@@ -1475,7 +1499,7 @@ These properties may be used to fontify the menu references.")
 
 ;;;###autoload
 (defun ffap-menu (&optional rescan)
-  "Put up a menu of files and urls mentioned in this buffer.
+  "Put up a menu of files and URLs mentioned in this buffer.
 Then set mark, jump to choice, and try to fetch it.  The menu is
 cached in `ffap-menu-alist', and rebuilt by `ffap-menu-rescan'.
 The optional RESCAN argument \(a prefix, interactively\) forces
@@ -1601,7 +1625,7 @@ Ignored when `ffap-at-mouse' is called programmatically.")
 
 ;;;###autoload
 (defun ffap-at-mouse (e)
-  "Find file or url guessed from text around mouse click.
+  "Find file or URL guessed from text around mouse click.
 Interactively, calls `ffap-at-mouse-fallback' if no guess is found.
 Return value:
   * if a guess string is found, return it (after finding it)
@@ -1629,7 +1653,7 @@ Return value:
      ((called-interactively-p 'interactive)
       (if ffap-at-mouse-fallback
          (call-interactively ffap-at-mouse-fallback)
-       (message "No file or url found at mouse click.")
+       (message "No file or URL found at mouse click.")
        nil))                           ; no fallback, return nil
      ;; failure: return nil
      )))
@@ -1674,6 +1698,13 @@ Only intended for interactive use."
       (set-window-dedicated-p win wdp))
     value))
 
+(defun ffap--toggle-read-only (buffer-or-list)
+  (dolist (buffer (if (listp buffer-or-list)
+                     buffer-or-list
+                   (list buffer-or-list)))
+    (with-current-buffer buffer
+      (toggle-read-only 1))))
+
 (defun ffap-read-only ()
   "Like `ffap', but mark buffer as read-only.
 Only intended for interactive use."
@@ -1681,8 +1712,7 @@ Only intended for interactive use."
   (let ((value (call-interactively 'ffap)))
     (unless (or (bufferp value) (bufferp (car-safe value)))
       (setq value (current-buffer)))
-    (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1)))
-         (if (listp value) value (list value)))
+    (ffap--toggle-read-only value)
     value))
 
 (defun ffap-read-only-other-window ()
@@ -1690,8 +1720,7 @@ Only intended for interactive use."
 Only intended for interactive use."
   (interactive)
   (let ((value (ffap-other-window)))
-    (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1)))
-         (if (listp value) value (list value)))
+    (ffap--toggle-read-only value)
     value))
 
 (defun ffap-read-only-other-frame ()
@@ -1699,8 +1728,7 @@ Only intended for interactive use."
 Only intended for interactive use."
   (interactive)
   (let ((value (ffap-other-frame)))
-    (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1)))
-         (if (listp value) value (list value)))
+    (ffap--toggle-read-only value)
     value))
 
 (defun ffap-alternate-file ()
@@ -1741,8 +1769,7 @@ Only intended for interactive use."
 (defun ffap-ro-mode-hook ()
   "Bind `ffap-next' and `ffap-menu' to M-l and M-m, resp."
   (local-set-key "\M-l" 'ffap-next)
-  (local-set-key "\M-m" 'ffap-menu)
-  )
+  (local-set-key "\M-m" 'ffap-menu))
 
 (defun ffap-gnus-hook ()
   "Bind `ffap-gnus-next' and `ffap-gnus-menu' to M-l and M-m, resp."
@@ -1786,17 +1813,11 @@ Only intended for interactive use."
   (interactive) (ffap-gnus-wrapper '(ffap-menu)))
 
 \f
-(defcustom dired-at-point-require-prefix nil
-  "If set, reverses the prefix argument to `dired-at-point'.
-This is nil so neophytes notice ffap.  Experts may prefer to disable
-ffap most of the time."
-  :type 'boolean
-  :group 'ffap
-  :version "20.3")
 
 ;;;###autoload
 (defun dired-at-point (&optional filename)
-  "Start Dired, defaulting to file at point.  See `ffap'."
+  "Start Dired, defaulting to file at point.  See `ffap'.
+If `dired-at-point-require-prefix' is set, the prefix meaning is reversed."
   (interactive)
   (if (and (called-interactively-p 'interactive)
           (if dired-at-point-require-prefix
@@ -1898,7 +1919,7 @@ Only intended for interactive use."
 ;;; Hooks to put in `file-name-at-point-functions':
 
 ;;;###autoload
-(progn (defun ffap-guess-file-name-at-point ()
+(defun ffap-guess-file-name-at-point ()
   "Try to get a file name at point.
 This hook is intended to be put in `file-name-at-point-functions'."
   (when (fboundp 'ffap-guesser)
@@ -1915,14 +1936,13 @@ This hook is intended to be put in `file-name-at-point-functions'."
       (when guess
        (if (file-directory-p guess)
            (file-name-as-directory guess)
-         guess))))))
+         guess)))))
 
 \f
 ;;; Offer default global bindings (`ffap-bindings'):
 
 (defvar ffap-bindings
-   '(
-     (global-set-key [S-mouse-3] 'ffap-at-mouse)
+   '((global-set-key [S-mouse-3] 'ffap-at-mouse)
      (global-set-key [C-S-mouse-3] 'ffap-menu)
 
      (global-set-key "\C-x\C-f" 'find-file-at-point)
@@ -1942,9 +1962,7 @@ This hook is intended to be put in `file-name-at-point-functions'."
      (add-hook 'gnus-summary-mode-hook 'ffap-gnus-hook)
      (add-hook 'gnus-article-mode-hook 'ffap-gnus-hook)
      (add-hook 'vm-mode-hook 'ffap-ro-mode-hook)
-     (add-hook 'rmail-mode-hook 'ffap-ro-mode-hook)
-     ;; (setq dired-x-hands-off-my-keys t) ; the default
-     )
+     (add-hook 'rmail-mode-hook 'ffap-ro-mode-hook))
      "List of binding forms evaluated by function `ffap-bindings'.
 A reasonable ffap installation needs just this one line:
   (ffap-bindings)
@@ -1959,5 +1977,4 @@ Of course if you do not like these bindings, just roll your own!")
 \f
 (provide 'ffap)
 
-;; arch-tag: 9dd3e88a-5dec-4607-bd57-60ae9ede8ebc
 ;;; ffap.el ends here