From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: Re: Emacs inventing system documentation Date: Fri, 19 Feb 2004 23:57:22 +0200 Organization: JURTA Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <873c968uzv.fsf@mail.jurta.org> References: <87lln0ey4g.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077237585 11291 80.91.224.253 (20 Feb 2004 00:39:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Feb 2004 00:39:45 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, John Basrai Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 20 01:39:35 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Atyhb-0002Bf-00 for ; Fri, 20 Feb 2004 01:39:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Atyfn-0000aJ-Az for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Feb 2004 19:37:43 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1Atyfj-0000ZQ-UV for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2004 19:37:39 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1AtyfC-0000TS-TC for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2004 19:37:38 -0500 Original-Received: from [66.33.219.6] (helo=knife.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Atydd-0008Cn-QX for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2004 19:35:29 -0500 Original-Received: from mail.jurta.org (80-235-43-226-dsl.mus.estpak.ee [80.235.43.226]) by knife.dreamhost.com (Postfix) with ESMTP id 7E22FE4051; Thu, 19 Feb 2004 16:35:21 -0800 (PST) Original-To: Eli Zaretskii In-Reply-To: (Eli Zaretskii's message of "19 Feb 2004 08:03:45 +0200") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:7030 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:7030 Eli Zaretskii writes: >> From: Juri Linkov >> Date: Thu, 18 Feb 2004 23:02:03 +0200 >> >> The following patch also fixes one bug (using `frame-width' instead of >> `window-width' causes too long lines when window is split >> horizontally), and sets `outline-regexp'. > > Does that code run before or after Emacs pops up the window where it > displays the formatted man page? If it runs before the window is > created, it might not be correct to take the value of COLUMNS from > whatever random window you happen to be in at that time. This code runs before the man page is formatted and displayed, and we don't know where the page will actually be displayed, so both frame-width and window-width are incorrect. But still window-width is better than frame-width, because it produces more correct results in one situation and don't make it worse in another. When window is split horizontally and window configuration is not changed before the man page window is displayed (by all notify methods except `newframe' and `bully'), then the result is more correct than current, where frame-window always causes too wide man pages for horizontally split windows. When window is not split or split vertically the result will be the same as now, because in this case frame-width = window-width. But for better customization I added a new defcustom Man-column-width to be able to define desired column width explicitly. And new value of woman-fill-frame is added in the woman.el to select between frame width, window width and column width. Btw, in the following patch I also added imenu-generic-expression for Man-mode (it don't call make-local-variable for imenu-generic-expression because its make-variable-buffer-local is autoloaded from imenu.el) and added outline-level with the constant first level for all headings. Index: emacs/lisp/man.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/man.el,v retrieving revision 1.132 diff -c -r1.132 man.el *** emacs/lisp/man.el 16 Feb 2004 18:20:31 -0000 1.132 --- emacs/lisp/man.el 20 Feb 2004 00:08:41 -0000 *************** *** 175,180 **** --- 175,186 ---- (const polite) (const quiet) (const meek)) :group 'man) + (defcustom Man-column-width 0 + "*Column width for formatted text. If value is 0 then either + frame width or window width is used." + :type 'integer + :group 'man) + (defcustom Man-frame-parameters nil "*Frame parameter list for creating a new frame for a manual page." :type 'sexp *************** *** 679,685 **** ;; This isn't strictly correct, since we don't know how ;; the page will actually be displayed, but it seems ;; reasonable. ! (setenv "COLUMNS" (number-to-string (frame-width))))) (setenv "GROFF_NO_SGR" "1") (if (fboundp 'start-process) (set-process-sentinel --- 685,700 ---- ;; This isn't strictly correct, since we don't know how ;; the page will actually be displayed, but it seems ;; reasonable. ! (setenv "COLUMNS" ! (number-to-string ! (cond ! ((and (integerp Man-column-width) ! (> Man-column-width 0)) ! Man-column-width) ! ((memq Man-notify-method '(newframe bully)) ! (frame-width)) ! (t ! (window-width))))))) (setenv "GROFF_NO_SGR" "1") (if (fboundp 'start-process) (set-process-sentinel *************** *** 757,763 **** "Convert overstriking and underlining to the correct fonts. Same for the ANSI bold and normal escape sequences." (interactive) ! (message "Please wait: making up the %s man page..." Man-arguments) (goto-char (point-min)) (while (search-forward "\e[1m" nil t) (delete-backward-char 4) --- 772,778 ---- "Convert overstriking and underlining to the correct fonts. Same for the ANSI bold and normal escape sequences." (interactive) ! (message "Please wait: formatting the %s man page..." Man-arguments) (goto-char (point-min)) (while (search-forward "\e[1m" nil t) (delete-backward-char 4) *************** *** 976,981 **** --- 991,999 ---- (auto-fill-mode -1) (use-local-map Man-mode-map) (set-syntax-table man-mode-syntax-table) + (setq imenu-generic-expression (list (list nil Man-heading-regexp 0))) + (set (make-local-variable 'outline-regexp) Man-heading-regexp) + (set (make-local-variable 'outline-level) (lambda () 1)) (Man-build-page-list) (Man-strip-page-headers) (Man-unindent) Index: emacs/lisp/woman.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/woman.el,v retrieving revision 1.18 diff -c -r1.18 woman.el *** emacs/lisp/woman.el 22 Sep 2003 15:15:26 -0000 1.18 --- emacs/lisp/woman.el 20 Feb 2004 00:08:45 -0000 *************** *** 807,814 **** (defcustom woman-fill-frame nil ;; Based loosely on a suggestion by Theodore Jump: ! "*If non-nil then most of the frame width is used." ! :type 'boolean :group 'woman-formatting) (defcustom woman-default-indent 5 --- 807,818 ---- (defcustom woman-fill-frame nil ;; Based loosely on a suggestion by Theodore Jump: ! "*If nil then `woman-fill-column' is used. ! If non-nil and not `window-width' then most of the frame width is used. ! If value is `window-width' then most of the window width is used." ! :type '(choice (const :tag "Column" nil) ! (const :tag "Window width" window-width) ! (other :tag "Frame width" t)) :group 'woman-formatting) (defcustom woman-default-indent 5 *************** *** 2204,2210 **** ;; Based loosely on a suggestion by Theodore Jump: (if (or woman-fill-frame (not (and (integerp woman-fill-column) (> woman-fill-column 0)))) ! (setq woman-fill-column (- (frame-width) woman-default-indent))) ;; Check for preprocessor requests: (goto-char from) --- 2208,2218 ---- ;; Based loosely on a suggestion by Theodore Jump: (if (or woman-fill-frame (not (and (integerp woman-fill-column) (> woman-fill-column 0)))) ! (setq woman-fill-column ! (- (if (eq woman-fill-frame 'window-width) ! (window-width) ! (frame-width)) ! woman-default-indent))) ;; Check for preprocessor requests: (goto-char from) -- http://www.jurta.org/emacs/