From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: patch to fill overlong lines in `describe-key' Date: Thu, 3 Jan 2008 11:59:45 -0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_003C_01C84E00.2197EB70" X-Trace: ger.gmane.org 1199390469 32413 80.91.229.12 (3 Jan 2008 20:01:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Jan 2008 20:01:09 +0000 (UTC) To: "Emacs-Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 03 21:01:29 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JAWFq-0005Hu-Dh for ged-emacs-devel@m.gmane.org; Thu, 03 Jan 2008 21:01:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JAWFU-0006KF-9f for ged-emacs-devel@m.gmane.org; Thu, 03 Jan 2008 15:01:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JAWFP-0006JD-9H for emacs-devel@gnu.org; Thu, 03 Jan 2008 15:00:59 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JAWFN-0006Ia-QH for emacs-devel@gnu.org; Thu, 03 Jan 2008 15:00:59 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JAWFN-0006IX-LC for emacs-devel@gnu.org; Thu, 03 Jan 2008 15:00:57 -0500 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JAWFM-0004Rr-Tb for emacs-devel@gnu.org; Thu, 03 Jan 2008 15:00:57 -0500 Original-Received: from agmgw2.us.oracle.com (agmgw2.us.oracle.com [152.68.180.213]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id m03K0siF004653 for ; Thu, 3 Jan 2008 13:00:54 -0700 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by agmgw2.us.oracle.com (Switch-3.2.0/Switch-3.2.0) with ESMTP id m03B17NM015245 for ; Thu, 3 Jan 2008 13:00:53 -0700 Original-Received: from 141.144.89.87 by acsmt350.oracle.com with ESMTP id 3474902701199390381; Thu, 03 Jan 2008 11:59:41 -0800 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:86008 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_003C_01C84E00.2197EB70 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit The first few lines output by `describe-key' can be overly long. Example: runs the command icicle-candidate-set-dired-marked-save-more which is an interactive compiled Lisp function in `icicles-cmd.el'. It is bound to C-), . (icicle-candidate-set-dired-marked-save-more &optional ARG) The code currently attempts to deal with this by hard-coding a newline before "which is", but that doesn't cut the mustard. The same problem can occur in some subsequent lines, because of embedded calls to `describe-function-1'. The attached patches fill the text of such occurrences as separate paragraphs. Example: runs the command icicle-candidate-set-dired-marked-save-more, which is an interactive compiled Lisp function in `icicles-cmd.el'. It is bound to C-), . (icicle-candidate-set-dired-marked-save-more &optional ARG) I also added a comma (,) before "which" in several places where it introduces an independent clause (see above for an example). I tested a similar patch against the 22.1 release code. Please try this out with the latest CVS code. There are several different cases to try, including mouse-2 remapping. Let me know if you find a case where it doesn't DTRT. ------=_NextPart_000_003C_01C84E00.2197EB70 Content-Type: application/octet-stream; name="help-2008-01-02.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="help-2008-01-02.patch" diff -c help-CVS-2008-01-02.el help-patched-2008-01-02.el=0A= *** help-CVS-2008-01-02.el Wed Jan 2 15:19:54 2008=0A= --- help-patched-2008-01-02.el Thu Jan 3 10:55:58 2008=0A= ***************=0A= *** 657,691 ****=0A= (cursor-in-echo-area t)=0A= saved-yank-menu)=0A= (unwind-protect=0A= ! (let (key)=0A= ! ;; If yank-menu is empty, populate it temporarily, so that=0A= ! ;; "Select and Paste" menu can generate a complete event.=0A= ! (when (null (cdr yank-menu))=0A= ! (setq saved-yank-menu (copy-sequence yank-menu))=0A= ! (menu-bar-update-yank-menu "(any string)" nil))=0A= ! (setq key (read-key-sequence "Describe key (or click or menu = item): "))=0A= ! (list=0A= ! key=0A= ! (prefix-numeric-value current-prefix-arg)=0A= ! ;; If KEY is a down-event, read and include the=0A= ! ;; corresponding up-event. Note that there are also=0A= ! ;; down-events on scroll bars and mode lines: the actual=0A= ! ;; event then is in the second element of the vector.=0A= ! (and (vectorp key)=0A= ! (let ((last-idx (1- (length key))))=0A= ! (and (eventp (aref key last-idx))=0A= ! (memq 'down (event-modifiers (aref key last-idx)))))=0A= ! (or (and (eventp (aref key 0))=0A= ! (memq 'down (event-modifiers (aref key 0)))=0A= ! ;; However, for the C-down-mouse-2 popup=0A= ! ;; menu, there is no subsequent up-event. In=0A= ! ;; this case, the up-event is the next=0A= ! ;; element in the supplied vector.=0A= ! (=3D (length key) 1))=0A= ! (and (> (length key) 1)=0A= ! (eventp (aref key 1))=0A= ! (memq 'down (event-modifiers (aref key 1)))))=0A= ! (read-event))))=0A= ;; Put yank-menu back as it was, if we changed it.=0A= (when saved-yank-menu=0A= (setq yank-menu (copy-sequence saved-yank-menu))=0A= --- 657,691 ----=0A= (cursor-in-echo-area t)=0A= saved-yank-menu)=0A= (unwind-protect=0A= ! (let (key)=0A= ! ;; If yank-menu is empty, populate it temporarily, so that=0A= ! ;; "Select and Paste" menu can generate a complete event.=0A= ! (when (null (cdr yank-menu))=0A= ! (setq saved-yank-menu (copy-sequence yank-menu))=0A= ! (menu-bar-update-yank-menu "(any string)" nil))=0A= ! (setq key (read-key-sequence "Describe key (or click or = menu item): "))=0A= ! (list=0A= ! key=0A= ! (prefix-numeric-value current-prefix-arg)=0A= ! ;; If KEY is a down-event, read and include the=0A= ! ;; corresponding up-event. Note that there are also=0A= ! ;; down-events on scroll bars and mode lines: the actual=0A= ! ;; event then is in the second element of the vector.=0A= ! (and (vectorp key)=0A= ! (let ((last-idx (1- (length key))))=0A= ! (and (eventp (aref key last-idx))=0A= ! (memq 'down (event-modifiers (aref key = last-idx)))))=0A= ! (or (and (eventp (aref key 0))=0A= ! (memq 'down (event-modifiers (aref key 0)))=0A= ! ;; However, for the C-down-mouse-2 popup=0A= ! ;; menu, there is no subsequent up-event. = In=0A= ! ;; this case, the up-event is the next=0A= ! ;; element in the supplied vector.=0A= ! (=3D (length key) 1))=0A= ! (and (> (length key) 1)=0A= ! (eventp (aref key 1))=0A= ! (memq 'down (event-modifiers (aref key = 1)))))=0A= ! (read-event))))=0A= ;; Put yank-menu back as it was, if we changed it.=0A= (when saved-yank-menu=0A= (setq yank-menu (copy-sequence saved-yank-menu))=0A= ***************=0A= *** 745,752 ****=0A= (with-help-window (help-buffer)=0A= (princ (help-key-description key untranslated))=0A= (princ (format "\=0A= ! %s runs the command %S=0A= ! which is "=0A= mouse-msg defn))=0A= (describe-function-1 defn)=0A= (when up-event=0A= --- 745,751 ----=0A= (with-help-window (help-buffer)=0A= (princ (help-key-description key untranslated))=0A= (princ (format "\=0A= ! %s runs the command %S, which is "=0A= mouse-msg defn))=0A= (describe-function-1 defn)=0A= (when up-event=0A= ***************=0A= *** 757,780 ****=0A= =0A= ----------------- up-event %s----------------=0A= =0A= ! <%S>%s%s runs the command %S=0A= ! which is "=0A= ! (if mouse-1-tricky "(short click) " "")=0A= ! ev-type mouse-msg=0A= ! (if mouse-1-remapped=0A= ! " is remapped to \nwhich" "")=0A= ! defn-up))=0A= ! (describe-function-1 defn-up))=0A= ! (unless (or (null defn-up-tricky)=0A= ! (integerp defn-up-tricky)=0A= ! (eq defn-up-tricky 'undefined))=0A= ! (princ (format "=0A= =0A= ----------------- up-event (long click) ----------------=0A= =0A= Pressing <%S>%s for longer than %d milli-seconds=0A= ! runs the command %S=0A= ! which is "=0A= ev-type mouse-msg=0A= mouse-1-click-follows-link=0A= defn-up-tricky))=0A= --- 756,777 ----=0A= =0A= ----------------- up-event %s----------------=0A= =0A= ! <%S>%s%s runs the command %S, which is "=0A= ! (if mouse-1-tricky "(short click) " "")=0A= ! ev-type mouse-msg=0A= ! (if mouse-1-remapped=0A= ! " is remapped to , which" "")=0A= ! defn-up))=0A= ! (describe-function-1 defn-up))=0A= ! (unless (or (null defn-up-tricky)=0A= ! (integerp defn-up-tricky)=0A= ! (eq defn-up-tricky 'undefined))=0A= ! (princ (format "=0A= =0A= ----------------- up-event (long click) ----------------=0A= =0A= Pressing <%S>%s for longer than %d milli-seconds=0A= ! runs the command %S, which is "=0A= ev-type mouse-msg=0A= mouse-1-click-follows-link=0A= defn-up-tricky))=0A= =0A= ------=_NextPart_000_003C_01C84E00.2197EB70 Content-Type: application/octet-stream; name="help-fns-2007-10-19.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="help-fns-2007-10-19.patch" *** help-fns-CVS-2007-10-19.el Fri Oct 19 10:38:10 2007=0A= --- help-fns-patched-2007-10-19.el Fri Oct 19 11:39:10 2007=0A= ***************=0A= *** 38,45 ****=0A= ;; Functions=0A= =0A= ;;;###autoload=0A= ! (defun describe-function (function)=0A= ! "Display the full documentation of FUNCTION (a symbol)."=0A= (interactive=0A= (let ((fn (function-called-at-point))=0A= (enable-recursive-minibuffers t)=0A= --- 38,48 ----=0A= ;; Functions=0A= =0A= ;;;###autoload=0A= ! (defun describe-function (function &optional commandp)=0A= ! "Display the full documentation of FUNCTION (a symbol).=0A= ! FUNCTION names an Emacs Lisp function, possibly a user command.=0A= ! With a prefix arg, candidates are commands (interactive functions).=0A= ! Returns the description that was displayed, as a string."=0A= (interactive=0A= (let ((fn (function-called-at-point))=0A= (enable-recursive-minibuffers t)=0A= ***************=0A= *** 47,58 ****=0A= (setq val (completing-read (if fn=0A= (format "Describe function (default %s): " fn)=0A= "Describe function: ")=0A= ! obarray 'fboundp t nil nil=0A= ! (and fn (symbol-name fn))))=0A= ! (list (if (equal val "")=0A= ! fn (intern val)))))=0A= (if (null function)=0A= (message "You didn't specify a function")=0A= (help-setup-xref (list #'describe-function function) = (interactive-p))=0A= (save-excursion=0A= (with-output-to-temp-buffer (help-buffer)=0A= --- 50,63 ----=0A= (setq val (completing-read (if fn=0A= (format "Describe function (default %s): " fn)=0A= "Describe function: ")=0A= ! obarray (if current-prefix-arg 'commandp 'fboundp)=0A= ! t nil nil (and fn (symbol-name fn))))=0A= ! (list (if (equal val "") fn (intern val))=0A= ! current-prefix-arg)))=0A= (if (null function)=0A= (message "You didn't specify a function")=0A= + (unless (or (not commandp) (commandp function))=0A= + (error "Not a defined Emacs command (interactive function): = `%s'" function))=0A= (help-setup-xref (list #'describe-function function) = (interactive-p))=0A= (save-excursion=0A= (with-output-to-temp-buffer (help-buffer)=0A= ***************=0A= *** 66,71 ****=0A= --- 71,92 ----=0A= ;; Return the text we displayed.=0A= (buffer-string))))))=0A= =0A= + ;;;###autoload=0A= + (defun describe-command (function)=0A= + "Describe an Emacs command (interactive function).=0A= + Same as using a prefix argument with command `describe-function'."=0A= + (interactive=0A= + (let ((fn (function-called-at-point))=0A= + (enable-recursive-minibuffers t)=0A= + val)=0A= + (setq val (completing-read (if fn=0A= + (format "Describe command (default %s): " fn)=0A= + "Describe command: ")=0A= + obarray 'commandp t nil nil=0A= + (and fn (symbol-name fn))))=0A= + (list (if (equal val "") fn (intern val)))))=0A= + (describe-function function t))=0A= + =0A= (defun help-split-fundoc (docstring def)=0A= "Split a function DOCSTRING into the actual doc and the usage info.=0A= Return (USAGE . DOC) or nil if there's no usage info.=0A= ***************=0A= *** 457,467 ****=0A= 0))=0A= =0A= ;;;###autoload=0A= ! (defun describe-variable (variable &optional buffer frame)=0A= "Display the full documentation of VARIABLE (a symbol).=0A= ! Returns the documentation as a string, also.=0A= If VARIABLE has a buffer-local value in BUFFER or FRAME=0A= ! \(default to the current buffer and current frame),=0A= it is displayed along with the global value."=0A= (interactive=0A= (let ((v (variable-at-point))=0A= --- 478,490 ----=0A= 0))=0A= =0A= ;;;###autoload=0A= ! (defun describe-variable (variable &optional buffer frame optionp)=0A= "Display the full documentation of VARIABLE (a symbol).=0A= ! VARIABLE names an Emacs Lisp variable, possibly a user option.=0A= ! With a prefix argument, candidates are user variables (options) only.=0A= ! Returns the documentation as a string.=0A= If VARIABLE has a buffer-local value in BUFFER or FRAME=0A= ! \(default to the current buffer and current frame), then=0A= it is displayed along with the global value."=0A= (interactive=0A= (let ((v (variable-at-point))=0A= ***************=0A= *** 472,488 ****=0A= "Describe variable (default %s): " v)=0A= "Describe variable: ")=0A= obarray=0A= ! '(lambda (vv)=0A= ! (or (boundp vv)=0A= ! (get vv 'variable-documentation)))=0A= t nil nil=0A= (if (symbolp v) (symbol-name v))))=0A= ! (list (if (equal val "")=0A= ! v (intern val)))))=0A= (unless (buffer-live-p buffer) (setq buffer (current-buffer)))=0A= (unless (frame-live-p frame) (setq frame (selected-frame)))=0A= (if (not (symbolp variable))=0A= (message "You did not specify a variable")=0A= (save-excursion=0A= (let ((valvoid (not (with-current-buffer buffer (boundp = variable))))=0A= val val-start-pos locus)=0A= --- 495,516 ----=0A= "Describe variable (default %s): " v)=0A= "Describe variable: ")=0A= obarray=0A= ! (if current-prefix-arg=0A= ! (lambda (vv) (user-variable-p vv))=0A= ! (lambda (vv)=0A= ! (or (boundp vv) (get vv = 'variable-documentation))))=0A= t nil nil=0A= (if (symbolp v) (symbol-name v))))=0A= ! (list (if (equal val "") v (intern val))=0A= ! nil=0A= ! nil=0A= ! current-prefix-arg)))=0A= (unless (buffer-live-p buffer) (setq buffer (current-buffer)))=0A= (unless (frame-live-p frame) (setq frame (selected-frame)))=0A= (if (not (symbolp variable))=0A= (message "You did not specify a variable")=0A= + (unless (or (not optionp) (user-variable-p variable))=0A= + (error "Not a defined Emacs user option: `%s'" variable))=0A= (save-excursion=0A= (let ((valvoid (not (with-current-buffer buffer (boundp = variable))))=0A= val val-start-pos locus)=0A= ***************=0A= *** 662,667 ****=0A= --- 690,713 ----=0A= ;; Return the text we displayed.=0A= (buffer-string))))))))=0A= =0A= + ;;;###autoload=0A= + (defun describe-option (variable &optional buffer frame)=0A= + "Describe an Emacs user variable (option).=0A= + Same as using a prefix argument with command `describe-variable'."=0A= + (interactive=0A= + (let ((v (variable-at-point))=0A= + (enable-recursive-minibuffers t)=0A= + val)=0A= + (setq val (completing-read (if (symbolp v)=0A= + (format "Describe option (default %s): " v)=0A= + "Describe option: ")=0A= + obarray 'user-variable-p t nil nil=0A= + (if (symbolp v) (symbol-name v))))=0A= + (list (if (equal val "") v (intern val))=0A= + nil=0A= + nil=0A= + current-prefix-arg)))=0A= + (describe-variable variable buffer frame t))=0A= =0A= ;;;###autoload=0A= (defun describe-syntax (&optional buffer)=0A= =0A= Diff finished. Fri Oct 19 12:02:43 2007=0A= ------=_NextPart_000_003C_01C84E00.2197EB70 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel ------=_NextPart_000_003C_01C84E00.2197EB70--