[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/man.el [lexbind]
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/man.el [lexbind] |
Date: |
Tue, 14 Oct 2003 19:52:10 -0400 |
Index: emacs/lisp/man.el
diff -c emacs/lisp/man.el:1.111.4.1 emacs/lisp/man.el:1.111.4.2
*** emacs/lisp/man.el:1.111.4.1 Fri Apr 4 01:20:10 2003
--- emacs/lisp/man.el Tue Oct 14 19:51:17 2003
***************
*** 1,6 ****
! ;;; man.el --- browse UNIX manual pages
! ;; Copyright (C) 1993, 1994, 1996, 1997, 2001 Free Software Foundation, Inc.
;; Author: Barry A. Warsaw <address@hidden>
;; Maintainer: FSF
--- 1,6 ----
! ;;; man.el --- browse UNIX manual pages -*- coding: iso-8859-1 -*-
! ;; Copyright (C) 1993, 1994, 1996, 1997, 2001, 2003 Free Software Foundation,
Inc.
;; Author: Barry A. Warsaw <address@hidden>
;; Maintainer: FSF
***************
*** 241,247 ****
(defvar Man-cooked-hook nil
"Hook run after removing backspaces but before `Man-mode' processing.")
! (defvar Man-name-regexp "[-a-zA-Z0-9_][-a-zA-Z0-9_.]*"
"Regular expression describing the name of a manpage (without section).")
(defvar Man-section-regexp "[0-9][a-zA-Z+]*\\|[LNln]"
--- 241,247 ----
(defvar Man-cooked-hook nil
"Hook run after removing backspaces but before `Man-mode' processing.")
! (defvar Man-name-regexp "[-a-zA-Z0-9_+][-a-zA-Z0-9_.+]*"
"Regular expression describing the name of a manpage (without section).")
(defvar Man-section-regexp "[0-9][a-zA-Z+]*\\|[LNln]"
***************
*** 256,262 ****
"(\\(" Man-section-regexp "\\))\\).*\\1"))
"Regular expression describing the heading of a page.")
! (defvar Man-heading-regexp "^\\([A-Z][A-Z ]+\\)$"
"Regular expression describing a manpage heading entry.")
(defvar Man-see-also-regexp "SEE ALSO"
--- 256,262 ----
"(\\(" Man-section-regexp "\\))\\).*\\1"))
"Regular expression describing the heading of a page.")
! (defvar Man-heading-regexp "^\\([A-Z][A-Z -]+\\)$"
"Regular expression describing a manpage heading entry.")
(defvar Man-see-also-regexp "SEE ALSO"
***************
*** 504,520 ****
(error "Malformed Man-filter-list"))
phrase)
pargs " ")))
! (setq flist (cdr flist))))
command))
(defun Man-translate-references (ref)
"Translates REF from \"chmod(2V)\" to \"2v chmod\" style.
Leave it as is if already in that style. Possibly downcase and
translate the section (see the Man-downcase-section-letters-flag
and the Man-section-translations-alist variables)."
(let ((name "")
! (section "")
! (slist Man-section-translations-alist))
(cond
;; "chmod(2V)" case ?
((string-match (concat "^" Man-reference-regexp "$") ref)
--- 504,533 ----
(error "Malformed Man-filter-list"))
phrase)
pargs " ")))
! (setq flist (cdr flist))))
command))
+
+ (defun Man-translate-cleanup (string)
+ "Strip leading, trailing and middle spaces."
+ (when (stringp string)
+ ;; Strip leading and trailing
+ (if (string-match "^[ \t\f\r\n]*\\(.+[^ \t\f\r\n]\\)" string)
+ (setq string (match-string 1 string)))
+ ;; middle spaces
+ (setq string (replace-regexp-in-string "[\t\r\n]" " " string))
+ (setq string (replace-regexp-in-string " +" " " string))
+ string))
+
(defun Man-translate-references (ref)
"Translates REF from \"chmod(2V)\" to \"2v chmod\" style.
Leave it as is if already in that style. Possibly downcase and
translate the section (see the Man-downcase-section-letters-flag
and the Man-section-translations-alist variables)."
(let ((name "")
! (section "")
! (slist Man-section-translations-alist))
! (setq ref (Man-translate-cleanup ref))
(cond
;; "chmod(2V)" case ?
((string-match (concat "^" Man-reference-regexp "$") ref)
***************
*** 556,574 ****
(skip-chars-backward "-a-zA-Z0-9._+:")
(let ((start (point)))
(skip-chars-forward "-a-zA-Z0-9._+:")
! (setq word (buffer-substring start (point))))
(if (string-match "[._]+$" word)
(setq word (substring word 0 (match-beginning 0))))
;; If looking at something like ioctl(2) or brc(1M), include the
;; section number in the returned value. Remove text properties.
! (forward-word 1)
! ;; Use `format' here to clear any text props from `word'.
! (format "%s%s"
! word
(if (looking-at
(concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)"))
! (format "(%s)" (match-string 1))
! "")))))
;; ======================================================================
--- 569,586 ----
(skip-chars-backward "-a-zA-Z0-9._+:")
(let ((start (point)))
(skip-chars-forward "-a-zA-Z0-9._+:")
! (setq word (buffer-substring-no-properties start (point))))
(if (string-match "[._]+$" word)
(setq word (substring word 0 (match-beginning 0))))
+ ;; If looking at something like *strcat(... , remove the '*'
+ (if (string-match "^*" word)
+ (setq word (substring word 1)))
;; If looking at something like ioctl(2) or brc(1M), include the
;; section number in the returned value. Remove text properties.
! (concat word
(if (looking-at
(concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)"))
! (format "(%s)" (match-string-no-properties 1)))))))
;; ======================================================================
***************
*** 578,583 ****
--- 590,596 ----
;;;###autoload
(defalias 'manual-entry 'man)
+
;;;###autoload
(defun man (man-args)
"Get a Un*x manual page and put it in a buffer.
***************
*** 667,678 ****
;; the page will actually be displayed, but it seems
;; reasonable.
(setenv "COLUMNS" (number-to-string (frame-width)))))
(if (fboundp 'start-process)
(set-process-sentinel
(start-process manual-program buffer "sh" "-c"
(format (Man-build-man-command) man-args))
'Man-bgproc-sentinel)
- (setenv "GROFF_NO_SGR" "1")
(let ((exit-status
(call-process shell-file-name nil (list buffer nil) nil "-c"
(format (Man-build-man-command) man-args)))
--- 680,691 ----
;; the page will actually be displayed, but it seems
;; reasonable.
(setenv "COLUMNS" (number-to-string (frame-width)))))
+ (setenv "GROFF_NO_SGR" "1")
(if (fboundp 'start-process)
(set-process-sentinel
(start-process manual-program buffer "sh" "-c"
(format (Man-build-man-command) man-args))
'Man-bgproc-sentinel)
(let ((exit-status
(call-process shell-file-name nil (list buffer nil) nil "-c"
(format (Man-build-man-command) man-args)))
***************
*** 999,1005 ****
;; Update len, in case a reference spans
;; more than two lines (paranoia).
len (1- (length word))))
! (if (= (aref word len) ?-)
(setq hyphenated (substring word 0 len)))
(if (string-match Man-reference-regexp word)
(aput 'Man-refpages-alist word))))
--- 1012,1018 ----
;; Update len, in case a reference spans
;; more than two lines (paranoia).
len (1- (length word))))
! (if (memq (aref word len) '(?- ?))
(setq hyphenated (substring word 0 len)))
(if (string-match Man-reference-regexp word)
(aput 'Man-refpages-alist word))))
***************
*** 1198,1204 ****
(aheadsym Man-refpages-alist)))
chosen
(prompt (concat "Refer to: (default " default ") ")))
! (setq chosen (completing-read prompt Man-refpages-alist nil t))
(if (or (not chosen)
(string= chosen ""))
default
--- 1211,1217 ----
(aheadsym Man-refpages-alist)))
chosen
(prompt (concat "Refer to: (default " default ") ")))
! (setq chosen (completing-read prompt Man-refpages-alist))
(if (or (not chosen)
(string= chosen ""))
default
***************
*** 1294,1297 ****
--- 1307,1311 ----
(provide 'man)
+ ;;; arch-tag: 587cda76-8e23-4594-b1f3-89b6b09a0d47
;;; man.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/man.el [lexbind],
Miles Bader <=