Function: cperl-electric-pod
cperl-electric-pod is a byte-compiled function defined in
cperl-mode.el.gz.
Signature
(cperl-electric-pod)
Documentation
Insert a POD chunk appropriate after a =POD directive.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cperl-mode.el.gz
(defun cperl-electric-pod ()
"Insert a POD chunk appropriate after a =POD directive."
(let ((delete (and (memq last-command-event '(?\s ?\n ?\t ?\f))
(memq this-command '(self-insert-command newline))))
head1 notlast name p really-delete over)
(and (save-excursion
(forward-word-strictly -1)
(and
(eq (preceding-char) ?=)
(progn
(setq head1 (looking-at "head1\\>[ \t]*$"))
(setq over (and (looking-at "over\\>[ \t]*$")
(not (looking-at "over[ \t]*\n\n\n*=item\\>"))))
(forward-char -1)
(bolp))
(or
(get-text-property (point) 'in-pod)
(cperl-after-expr-p nil "{;:")
(and (re-search-backward "\\(\\`\n?\\|^\n\\)=\\sw+" (point-min) t)
(not (or (looking-at "\n*=cut") (looking-at "\n*=end")))
(or (not cperl-use-syntax-table-text-property)
(eq (get-text-property (point) 'syntax-type) 'pod))))))
(progn
(save-excursion
(setq notlast (re-search-forward "^\n=" nil t)))
(or notlast
(progn
(insert "\n\n=cut")
(cperl-ensure-newlines 2)
(forward-word-strictly -2)
(if (and head1
(not
(save-excursion
(forward-char -1)
(re-search-backward "\\(\\`\n?\\|\n\n\\)=head1\\>"
nil t)))) ; Only one
(progn
(forward-word-strictly 1)
(setq name (file-name-base (buffer-file-name))
p (point))
(insert " NAME\n\n" name
" - \n\n=head1 SYNOPSIS\n\n\n\n"
"=head1 DESCRIPTION")
(cperl-ensure-newlines 4)
(goto-char p)
(forward-word-strictly 2)
(end-of-line)
(setq really-delete t))
(forward-word-strictly 1))))
(if over
(progn
(setq p (point))
(insert "\n\n=item \n\n\n\n"
"=back")
(cperl-ensure-newlines 2)
(goto-char p)
(forward-word-strictly 1)
(end-of-line)
(setq really-delete t)))
(if (and delete really-delete)
(cperl-putback-char cperl-del-back-ch))))))