]> code.delx.au - gnu-emacs/blobdiff - lisp/woman.el
(match-string-no-properties): Use substring-no-properties.
[gnu-emacs] / lisp / woman.el
index 115e70546bb356d7c944098ba30a92f53a2539dd..6946930505f3e14ae9381c534193003e902be04d 100644 (file)
@@ -1058,13 +1058,6 @@ The ordinal numbers start from 0.")
 Should include ?e, ?o (page even/odd) and either ?n (nroff) or ?t (troff).
 Default is '(?n ?e ?o).  Set via `woman-emulation'.")
 
-\f
-;;; Button types:
-
-(define-button-type 'woman-xref
-  'action (lambda (button) (woman (button-label button)))
-  'help-echo "RET, mouse-2: display this man page")
-
 \f
 ;;; Specialized utility functions:
 
@@ -1228,7 +1221,7 @@ Optional argument RE-CACHE, if non-nil, forces the cache to be re-read."
                   ;; Was let-bound when file loaded, so ...
                   (setq woman-topic-at-point woman-topic-at-point-default)))
             (setq topic
-                  (current-word t))    ; only within or adjacent to word
+                  (or (current-word t) ""))    ; only within or adjacent to word
             (assoc topic woman-topic-all-completions))
        (setq topic
              (completing-read
@@ -1237,7 +1230,7 @@ Optional argument RE-CACHE, if non-nil, forces the cache to be re-read."
               ;; Initial input suggestion (was nil), with
               ;; cursor at left ready to kill suggestion!:
               (and woman-topic-at-point
-                   (cons (current-word) 0)) ; nearest word
+                   (cons (or (current-word) "") 0)) ; nearest word
               'woman-topic-history)))
     ;; Note that completing-read always returns a string.
     (if (= (length topic) 0)
@@ -1347,7 +1340,7 @@ Any UN*X-style environment variables are evaluated first."
   ;; including `.' and `..', so remove any trailing / !!!
   (if (string= (substring dir -1) "/")
       (setq dir (substring dir 0 -1)))
-  (if (memq system-type '(windows-nt ms-dos)) ; what else?
+  (if (memq system-type '(windows-nt ms-dos cygwin)) ; what else?
       ;; Match capitalization used by `file-name-directory':
       (setq dir (concat (file-name-directory dir)
                        (file-name-nondirectory dir))))
@@ -1751,7 +1744,7 @@ Leave point at end of new text.  Return length of inserted text."
 Argument EVENT is the invoking mouse event."
   (interactive "e")                    ; mouse event
   (goto-char (posn-point (event-start event)))
-  (woman (current-word t)))
+  (woman (or (current-word t) "")))
 
 ;; WoMan menu bar and pop-up menu:
 (easy-menu-define
@@ -1869,7 +1862,7 @@ See `Man-mode' for additional details."
     (setq woman-imenu-done nil)
     (if woman-imenu (woman-imenu))
     (setq buffer-read-only nil)
-    (WoMan-highlight-references)
+    (Man-highlight-references)
     (setq buffer-read-only t)
     (set-buffer-modified-p nil)))
 
@@ -1964,21 +1957,6 @@ Otherwise use Man and record start of formatting time."
                  (- (cadr time) (cadr WoMan-Man-start-time)))))
     (message "Man formatting done in %d seconds" time)))
 
-(defun WoMan-highlight-references ()
-  "Highlight the references (in the SEE ALSO section) on mouse-over."
-  ;; Based on `Man-build-references-alist' in `man'.
-  (when (Man-find-section Man-see-also-regexp)
-    (forward-line 1)
-    (let ((end (save-excursion
-                (Man-next-section 1)
-                (point))))
-      (back-to-indentation)
-      (while (re-search-forward Man-reference-regexp end t)
-       ;; Highlight reference when mouse is over it.
-       ;; (NB: WoMan does not hyphenate!)
-       (make-text-button (match-beginning 1) (match-end 1)
-                         'type 'woman-xref)))))
-
 \f
 ;;; Buffer handling:
 
@@ -4548,4 +4526,5 @@ logging the message."
 
 (provide 'woman)
 
+;;; arch-tag: eea35e90-552f-4712-a94b-d9ffd3db7651
 ;;; woman.el ends here