Commits

Anonymous committed 0b188be

* man.el (Manual-mode-syntax-table): syntax table for Manual mode
is added.
(manual-entry): uses syntax table of current buffer when search
defaults but allow wresize(3x) and similar as special case.
(manual-entry): if current position is first character of
identifier then use this identifier as default.
Andrew's patch "man.el.1-2.diff",
<20001019212329.A682@bcs.zp.ua>

  • Participants
  • Parent commits 46a1db1

Comments (0)

Files changed (2)

+2000-10-18  Andrew W. Nosenko  <awn@bcs.zp.ua>
+
+	* man.el (Manual-mode-syntax-table): syntax table for Manual mode
+	is added.
+	(manual-entry): uses syntax table of current buffer when search
+	defaults but allow wresize(3x) and similar as special case.
+	(manual-entry): if current position is first character of
+	identifier then use this identifier as default.
+
 2000-10-19  Steve Youngs  <youngs@xemacs.org>
 
 	* power-macros.el: New file.
     (define-key m 'button3 'Manual-popup-menu)
     m))
 
+(defvar Manual-mode-syntax-table nil
+  "Syntax table used in Manual-mode buffers")
+(if Manual-mode-syntax-table
+    ()
+  (setq Manual-mode-syntax-table (make-syntax-table))
+  (modify-syntax-entry ?: "_" Manual-mode-syntax-table)
+  (modify-syntax-entry ?+ "." Manual-mode-syntax-table)
+  (modify-syntax-entry ?- "." Manual-mode-syntax-table)
+  (modify-syntax-entry ?/ "." Manual-mode-syntax-table)
+  (modify-syntax-entry ?* "." Manual-mode-syntax-table)
+  )
+
 ;;;###autoload
 (defun manual-entry (topic &optional arg silent)
   "Display the Unix manual entry (or entries) for TOPIC."
    (list (let* ((default (save-excursion
 			   (buffer-substring
 			    (progn
-			      (re-search-backward "\\sw\\|\\s_" nil t)
+                              (if (not (eobp))
+                                  (forward-char))
+                              (if (re-search-backward "\\sw\\|\\s_" nil t)
+                                  (forward-char))
+                              (re-search-backward
+                               "\\(\\sw\\|\\s_\\)([0-9]+[A-Za-z]*\\=" nil t)
                               (skip-syntax-backward "w_")
                               (point))
 			    (progn
                               (skip-syntax-forward "w_")
+                              (re-search-forward "\\=([0-9]+[A-Za-z]*)" nil t)
                               (point) ))))
 		(thing (read-string
 			(if (equal default "") "Manual entry: "
   (kill-all-local-variables)
   (setq buffer-read-only t)
   (use-local-map Manual-mode-map)
+  (set-syntax-table Manual-mode-syntax-table)
   (setq major-mode 'Manual-mode
 	mode-name "Manual")
   ;; man pages with long lines are buggy!