comparison lisp/man.el @ 12809:c388f6f7f210

* man.el (Man-translate-references): Anchor the regexps.
author Francesco Potortì <pot@gnu.org>
date Wed, 09 Aug 1995 16:08:55 +0000
parents 960edccb320d
children a48a11952cc7
comparison
equal deleted inserted replaced
12808:4db1f387e85f 12809:c388f6f7f210
420 420
421 (defun Man-translate-references (ref) 421 (defun Man-translate-references (ref)
422 "Translates REF from \"chmod(2V)\" to \"2v chmod\" style. 422 "Translates REF from \"chmod(2V)\" to \"2v chmod\" style.
423 Leave it as is if already in that style. Possibly downcase and 423 Leave it as is if already in that style. Possibly downcase and
424 translate the section (see the Man-downcase-section-letters-flag 424 translate the section (see the Man-downcase-section-letters-flag
425 and the Man-section-translations-alist variables)." 425 and the Man-section-translations-alist variables)."
426 (let ((name "") 426 (let ((name "")
427 (section "") 427 (section "")
428 (slist Man-section-translations-alist)) 428 (slist Man-section-translations-alist))
429 (cond 429 (cond
430 ;; "chmod(2V)" case ? 430 ;; "chmod(2V)" case ?
431 ((string-match (concat Man-reference-regexp "$") ref) 431 ((string-match (concat "^" Man-reference-regexp "$") ref)
432 (setq name (Man-match-substring 1 ref) 432 (setq name (Man-match-substring 1 ref)
433 section (Man-match-substring 2 ref))) 433 section (Man-match-substring 2 ref)))
434 ;; "2v chmod" case ? 434 ;; "2v chmod" case ?
435 ((string-match (concat "\\(" Man-section-regexp 435 ((string-match (concat "^\\(" Man-section-regexp
436 "\\) +\\(" Man-name-regexp "\\)$") ref) 436 "\\) +\\(" Man-name-regexp "\\)$") ref)
437 (setq name (Man-match-substring 2 ref) 437 (setq name (Man-match-substring 2 ref)
438 section (Man-match-substring 1 ref)))) 438 section (Man-match-substring 1 ref))))
439 (if (string= name "") 439 (if (string= name "")
440 ref ; Return the reference as is 440 ref ; Return the reference as is