From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: man.el Date: Sat, 21 Feb 2004 03:04:12 +0200 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87znbdqgk3.fsf@mail.jurta.org> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077333192 10341 80.91.224.253 (21 Feb 2004 03:13:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 21 Feb 2004 03:13:12 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Feb 21 04:13:06 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AuNZi-0004lP-00 for ; Sat, 21 Feb 2004 04:13:06 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AuNZh-00067H-00 for ; Sat, 21 Feb 2004 04:13:05 +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 1AuNZJ-0004OV-I4 for emacs-devel@quimby.gnus.org; Fri, 20 Feb 2004 22:12:41 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1AuNZ0-00046b-HU for emacs-devel@gnu.org; Fri, 20 Feb 2004 22:12:22 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1AuNYM-0002W8-V5 for emacs-devel@gnu.org; Fri, 20 Feb 2004 22:12:15 -0500 Original-Received: from [66.33.219.6] (helo=knife.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1AuNYM-0002W5-Fs for emacs-devel@gnu.org; Fri, 20 Feb 2004 22:11:42 -0500 Original-Received: from mail.jurta.org (80-235-33-45-dsl.mus.estpak.ee [80.235.33.45]) by knife.dreamhost.com (Postfix) with ESMTP id EA945E402E for ; Fri, 20 Feb 2004 19:11:36 -0800 (PST) Original-To: emacs-devel@gnu.org In-Reply-To: (Richard Stallman's message of "Fri, 20 Feb 2004 08:41:37 -0500") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20090 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20090 Richard Stallman writes: > Regarding the change below, why is the current window's width more > likely to be correct than the frame's width? (Neither one is > guaranteed to be right.) The window's width is more correct than the frame's width when the frame is split horizontally, the method of notification is not `bully' or `newframe', and user don't change the window configuration after invoking man in the background. Since man formats pages asyncronically, it should know the number of columns before its invocation. But for the moment when man page is ready the user can change the window configuration (split window, or delete other windows, or change frame's or window's widths). This means that neither window's width nor frame's width is correct, and restoring the original window configuration before displaying the man page may be not desirable for the user. So instead of arguing which of the incorrect methods is more correct, it could be left completely to user's discretion. A new defcustom variable Man-width can have an integer value for explicit number of columns, or a special value for either frame-width or window-width. Along with the Man-notify-method option the user can use the Man-width to specify preferences for displaying man pages. 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 21 Feb 2004 01:57:20 -0000 *************** *** 175,180 **** --- 175,191 ---- (const polite) (const quiet) (const meek)) :group 'man) + (defcustom Man-width nil + "*Number of columns for which manual pages should be formatted. + If nil, the width of the frame selected at the moment of man + invocation is used. If non-nil, the width of the window selected + at the moment of man invocation is used. The value also can be a + positive integer." + :type '(choice (const :tag "Frame width" nil) + (const :tag "Window width" t) + (integer :tag "Specific width" :value 65)) + :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 --- 690,701 ---- ;; 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-width) (> Man-width 0)) ! Man-width) ! (Man-width (window-width)) ! ((frame-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) --- 773,779 ---- "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 **** --- 992,1000 ---- (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) The patch for woman.el follows below. Note that in the woman.el for the analogous purpose the frame-window can be changed to window-width unconditionally because woman displays man pages in the same window where it was invoked. 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 21 Feb 2004 01:57:23 -0000 *************** *** 807,813 **** (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) --- 807,813 ---- (defcustom woman-fill-frame nil ;; Based loosely on a suggestion by Theodore Jump: ! "*If non-nil then most of the window width is used." :type 'boolean :group 'woman-formatting) *************** *** 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) --- 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 (- (window-width) woman-default-indent))) ;; Check for preprocessor requests: (goto-char from) -- http://www.jurta.org/emacs/