(custom-face-value-create): If face name doesn't end with "face", add
[bpt/emacs.git] / lisp / bookmark.el
index 65f117a..1aaefcb 100644 (file)
@@ -215,13 +215,6 @@ following in your `.emacs' file:
     ;; some random value higher than 9600    
     (setq baud-rate 19200))
 
-;; XEmacs apparently call this `buffer-substring-without-properties',
-;; sigh.
-(or (fboundp 'buffer-substring-no-properties)
-    (if (fboundp 'buffer-substring-without-properties)
-        (fset 'buffer-substring-no-properties
-              'buffer-substring-without-properties)
-      (fset 'buffer-substring-no-properties 'buffer-substring)))
 
 \f
 ;;; Keymap stuff:
@@ -1084,6 +1077,22 @@ of the old one in the permanent bookmark record."
              (bookmark-show-annotation bookmark)))))
 
 
+(defun bookmark-file-or-variation-thereof (file)
+  "Return FILE (a string) if it exists in any reasonable variation, else nil.
+Reasonable variations are FILE.gz, FILE.Z, FILE.info, FILE.info.gz, etc."
+  (cond 
+   ((file-exists-p file)                       file)
+   ((file-exists-p (concat file ".Z"))         (concat file ".Z"))
+   ((file-exists-p (concat file ".gz"))        (concat file ".gz"))
+   ((file-exists-p (concat file ".z"))         (concat file ".z"))
+   ((file-exists-p (concat file ".info"))      (concat file ".info"))
+   ((file-exists-p (concat file ".info.gz"))   (concat file ".info.gz"))
+   ((file-exists-p (concat file ".info.Z"))    (concat file ".info.Z"))
+   ((file-exists-p (concat file ".info.z"))    (concat file ".info.z"))
+   ((vc-backend file)                          file) ; maybe VC has it?
+   (t                                          nil)))
+
+
 (defun bookmark-jump-noselect (str)
   ;; a leetle helper for bookmark-jump :-)
   ;; returns (BUFFER . POINT)
@@ -1095,23 +1104,7 @@ of the old one in the permanent bookmark record."
          (info-node              (bookmark-get-info-node str))
          (orig-file              file)
          )
-    (if (or
-         (file-exists-p file)
-         ;; else try some common compression extensions
-         ;; and Emacs better handle it right!
-         ;; Sigh: I think it may *not* be handled at the moment.  What
-         ;; to do about this?
-         (setq file
-               (or
-                (let ((altname (concat file ".Z")))
-                  (and (file-exists-p altname)
-                       altname))
-                (let ((altname (concat file ".gz")))
-                  (and (file-exists-p altname)
-                       altname))
-                (let ((altname (concat file ".z")))
-                  (and (file-exists-p altname)
-                       altname)))))
+    (if (setq file (bookmark-file-or-variation-thereof file))
         (save-excursion
           (save-window-excursion
             (if info-node
@@ -1182,7 +1175,7 @@ minibuffer history list `bookmark-history'."
   (let ((start (point)))
     (prog1
        (insert (bookmark-location bookmark)) ; *Return this line*
-      (if window-system
+      (if (and (display-color-p) (display-mouse-p))
          (put-text-property start 
                             (save-excursion (re-search-backward
                                              "[^ \t]")
@@ -1493,6 +1486,7 @@ method buffers use to resolve name collisions."
   (define-key bookmark-bmenu-mode-map "j" 'bookmark-bmenu-this-window)
   (define-key bookmark-bmenu-mode-map "\C-c\C-c" 'bookmark-bmenu-this-window)
   (define-key bookmark-bmenu-mode-map "f" 'bookmark-bmenu-this-window)
+  (define-key bookmark-bmenu-mode-map "\C-m" 'bookmark-bmenu-this-window)
   (define-key bookmark-bmenu-mode-map "o" 'bookmark-bmenu-other-window)
   (define-key bookmark-bmenu-mode-map "\C-o"
     'bookmark-bmenu-switch-other-window)
@@ -1567,7 +1561,7 @@ deletion, or > if it is flagged for displaying."
            (insert "  "))
         (let ((start (point)))
           (insert (bookmark-name-from-full-record full-record))
-          (if window-system
+          (if (and (display-color-p) (display-mouse-p))
               (put-text-property start 
                                  (save-excursion (re-search-backward
                                                   "[^ \t]")
@@ -1663,7 +1657,7 @@ Optional argument SHOW means show them unconditionally."
              (let ((start (save-excursion (end-of-line) (point))))
                (move-to-column bookmark-bmenu-file-column t)
                ;; Strip off `mouse-face' from the white spaces region.
-               (if window-system
+               (if (and (display-color-p) (display-mouse-p))
                    (remove-text-properties start (point)
                                            '(mouse-face))))
              (delete-region (point) (progn (end-of-line) (point)))
@@ -1694,7 +1688,7 @@ Optional argument SHOW means show them unconditionally."
                 (bookmark-kill-line)
                (let ((start (point)))
                  (insert (car bookmark-bmenu-hidden-bookmarks))
-                 (if window-system
+                 (if (and (display-color-p) (display-mouse-p))
                      (put-text-property start 
                                         (save-excursion (re-search-backward
                                                          "[^ \t]")