aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-06-09 04:03:45 +0000
committerRichard M. Stallman1998-06-09 04:03:45 +0000
commitb7ec9e590e96d3906bfab6580b4e15ee3ead1005 (patch)
tree10bae1c5981713116340e907b25c39e32e89259c
parent045c4971c770f35bea5146eda89b98c2c3a15267 (diff)
downloademacs-b7ec9e590e96d3906bfab6580b4e15ee3ead1005.tar.gz
emacs-b7ec9e590e96d3906bfab6580b4e15ee3ead1005.zip
(pod2man-program): Var reinstalled.
(cperl-pod-to-manpage, cperl-pod2man-build-command): Fns reinstalled.
-rw-r--r--lisp/progmodes/cperl-mode.el73
1 files changed, 71 insertions, 2 deletions
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 8a09e11a114..12dbb596131 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -6053,7 +6053,7 @@ We suppose that the regexp is scanned already."
6053 (cperl-beautify-regexp-piece b e nil))) 6053 (cperl-beautify-regexp-piece b e nil)))
6054 6054
6055(defun cperl-invert-if-unless () 6055(defun cperl-invert-if-unless ()
6056 "Changes `if (A) {B}' into `B if A;' if possible." 6056 "Change `if (A) {B}' into `B if A;' if possible."
6057 (interactive) 6057 (interactive)
6058 (or (looking-at "\\<") 6058 (or (looking-at "\\<")
6059 (forward-sexp -1)) 6059 (forward-sexp -1))
@@ -6137,7 +6137,76 @@ We suppose that the regexp is scanned already."
6137 (error "`%s' not with an (EXPR)" s0))) 6137 (error "`%s' not with an (EXPR)" s0)))
6138 (error "Not at `if', `unless', `while', or `unless'"))) 6138 (error "Not at `if', `unless', `while', or `unless'")))
6139 6139
6140(defvar Man-filter-list) 6140;;; Getting help on modules in C-h f ?
6141;;; This is a modified version of `man'.
6142;;; Need to teach it how to lookup functions
6143(defun cperl-perldoc (word)
6144 "Run `perldoc' on WORD."
6145 (interactive
6146 (list (let* ((default-entry (cperl-word-at-point))
6147 (input (read-string
6148 (format "perldoc entry%s: "
6149 (if (string= default-entry "")
6150 ""
6151 (format " (default %s)" default-entry))))))
6152 (if (string= input "")
6153 (if (string= default-entry "")
6154 (error "No perldoc args given")
6155 default-entry)
6156 input))))
6157 (let* ((is-func (and
6158 (string-match "^[a-z]+$" word)
6159 (string-match (concat "^" word "\\>")
6160 (documentation-property
6161 'cperl-short-docs
6162 'variable-documentation))))
6163 (manual-program (if is-func "perldoc -f" "perldoc")))
6164 (require 'man)
6165 (Man-getpage-in-background word)))
6166
6167(defun cperl-perldoc-at-point ()
6168 "Run a `perldoc' on the word around point."
6169 (interactive)
6170 (cperl-perldoc (cperl-word-at-point)))
6171
6172(defcustom pod2man-program "pod2man"
6173 "*File name for `pod2man'."
6174 :type 'file
6175 :group 'cperl)
6176
6177(defun cperl-pod-to-manpage ()
6178 "Create a virtual manpage in Emacs from the Perl Online Documentation."
6179 (interactive)
6180 (require 'man)
6181 (let* ((pod2man-args (concat buffer-file-name " | nroff -man "))
6182 (bufname (concat "Man " buffer-file-name))
6183 (buffer (generate-new-buffer bufname)))
6184 (save-excursion
6185 (set-buffer buffer)
6186 (let ((process-environment (copy-sequence process-environment)))
6187 ;; Prevent any attempt to use display terminal fanciness.
6188 (setenv "TERM" "dumb")
6189 (set-process-sentinel
6190 (start-process pod2man-program buffer "sh" "-c"
6191 (format (cperl-pod2man-build-command) pod2man-args))
6192 'Man-bgproc-sentinel)))))
6193
6194(defun cperl-pod2man-build-command ()
6195 "Builds the entire background manpage and cleaning command."
6196 (let ((command (concat pod2man-program " %s 2>/dev/null"))
6197 (flist Man-filter-list))
6198 (while (and flist (car flist))
6199 (let ((pcom (car (car flist)))
6200 (pargs (cdr (car flist))))
6201 (setq command
6202 (concat command " | " pcom " "
6203 (mapconcat '(lambda (phrase)
6204 (if (not (stringp phrase))
6205 (error "Malformed Man-filter-list"))
6206 phrase)
6207 pargs " ")))
6208 (setq flist (cdr flist))))
6209 command))
6141 6210
6142(defun cperl-lazy-install ()) ; Avoid a warning 6211(defun cperl-lazy-install ()) ; Avoid a warning
6143 6212