diff options
| author | Juanma Barranquero | 2003-07-13 17:16:31 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2003-07-13 17:16:31 +0000 |
| commit | 7e734986ab48dfda91450d672d5f701959d17569 (patch) | |
| tree | cc59bb3988292b511fa27e090dbc02b7fd8bd4da | |
| parent | 76b7c637127de4ac50fbbd8c840ea9778a7f3249 (diff) | |
| download | emacs-7e734986ab48dfda91450d672d5f701959d17569.tar.gz emacs-7e734986ab48dfda91450d672d5f701959d17569.zip | |
(Man-translate-cleanup): New.
(Man-translate-references): Call `Man-translate-cleanup' to clean leading,
trailing and middle spaces.
| -rw-r--r-- | lisp/man.el | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lisp/man.el b/lisp/man.el index f46d731c745..a2ff8ad3d53 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -504,17 +504,30 @@ This is necessary if one wants to dump man.el with Emacs." | |||
| 504 | (error "Malformed Man-filter-list")) | 504 | (error "Malformed Man-filter-list")) |
| 505 | phrase) | 505 | phrase) |
| 506 | pargs " "))) | 506 | pargs " "))) |
| 507 | (setq flist (cdr flist)))) | 507 | (setq flist (cdr flist)))) |
| 508 | command)) | 508 | command)) |
| 509 | 509 | ||
| 510 | |||
| 511 | (defun Man-translate-cleanup (string) | ||
| 512 | "Strip leading, trailing and middle spaces." | ||
| 513 | (when (stringp string) | ||
| 514 | ;; Strip leading and trailing | ||
| 515 | (if (string-match "^[ \t\f\r\n]*\\(.+[^ \t\f\r\n]\\)" string) | ||
| 516 | (setq string (match-string 1 string))) | ||
| 517 | ;; middle spaces | ||
| 518 | (setq string (replace-regexp-in-string "[\t\r\n]" " " string)) | ||
| 519 | (setq string (replace-regexp-in-string " +" " " string)) | ||
| 520 | string)) | ||
| 521 | |||
| 510 | (defun Man-translate-references (ref) | 522 | (defun Man-translate-references (ref) |
| 511 | "Translates REF from \"chmod(2V)\" to \"2v chmod\" style. | 523 | "Translates REF from \"chmod(2V)\" to \"2v chmod\" style. |
| 512 | Leave it as is if already in that style. Possibly downcase and | 524 | Leave it as is if already in that style. Possibly downcase and |
| 513 | translate the section (see the Man-downcase-section-letters-flag | 525 | translate the section (see the Man-downcase-section-letters-flag |
| 514 | and the Man-section-translations-alist variables)." | 526 | and the Man-section-translations-alist variables)." |
| 515 | (let ((name "") | 527 | (let ((name "") |
| 516 | (section "") | 528 | (section "") |
| 517 | (slist Man-section-translations-alist)) | 529 | (slist Man-section-translations-alist)) |
| 530 | (setq ref (Man-translate-cleanup ref)) | ||
| 518 | (cond | 531 | (cond |
| 519 | ;; "chmod(2V)" case ? | 532 | ;; "chmod(2V)" case ? |
| 520 | ((string-match (concat "^" Man-reference-regexp "$") ref) | 533 | ((string-match (concat "^" Man-reference-regexp "$") ref) |
| @@ -578,6 +591,7 @@ This guess is based on the text surrounding the cursor." | |||
| 578 | ;;;###autoload | 591 | ;;;###autoload |
| 579 | (defalias 'manual-entry 'man) | 592 | (defalias 'manual-entry 'man) |
| 580 | 593 | ||
| 594 | |||
| 581 | ;;;###autoload | 595 | ;;;###autoload |
| 582 | (defun man (man-args) | 596 | (defun man (man-args) |
| 583 | "Get a Un*x manual page and put it in a buffer. | 597 | "Get a Un*x manual page and put it in a buffer. |