Function: Man-cleanup-manpage

Man-cleanup-manpage is an interactive and byte-compiled function defined in man.el.gz.

Signature

(Man-cleanup-manpage &optional INTERACTIVE)

Documentation

Remove overstriking and underlining from the current buffer.

Normally skip any jobs that should have been done by the sed script, but when called interactively, do those jobs even if the sed script would have done them.

Probably introduced at or before Emacs version 19.29.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/man.el.gz
(defun Man-cleanup-manpage (&optional interactive)
  "Remove overstriking and underlining from the current buffer.
Normally skip any jobs that should have been done by the sed script,
but when called interactively, do those jobs even if the sed
script would have done them."
  (interactive "p" man-common)
  (if (or interactive (not Man-sed-script))
      (progn
	(goto-char (point-min))
	(while (search-forward "_\b" nil t) (backward-delete-char 2))
	(goto-char (point-min))
	(while (search-forward "\b_" nil t) (backward-delete-char 2))
	(goto-char (point-min))
	(while (re-search-forward "\\(.\\)\\(\b\\1\\)+" nil t)
	  (replace-match "\\1"))
	(goto-char (point-min))
	(while (re-search-forward "\e\\[[0-9]+m" nil t) (replace-match ""))
	(goto-char (point-min))
	(while (re-search-forward "o\b\\+\\|\\+\bo" nil t) (replace-match "o"))
	))
  (goto-char (point-min))
  (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) (replace-match "+"))
  ;; When the header is longer than the manpage name, groff tries to
  ;; condense it to a shorter line interspersed with ^H.  Remove ^H with
  ;; their preceding chars (but don't put Man-overstrike).  (Bug#5566)
  (goto-char (point-min))
  (while (re-search-forward ".\b" nil t) (backward-delete-char 2))
  (Man-softhyphen-to-minus))