From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.devel Subject: Re: [drew.adams@oracle.com: links in Help buffer aren'talwayscorrect] Date: Mon, 19 Dec 2005 11:22:08 -0800 (PST) Message-ID: <20051219192208.31866.qmail@web51011.mail.yahoo.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0-1507877980-1135020128=:31350" Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1135020293 3814 80.91.229.2 (19 Dec 2005 19:24:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 19 Dec 2005 19:24:53 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 19 20:24:53 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EoQaw-0005Gm-WB for ged-emacs-devel@m.gmane.org; Mon, 19 Dec 2005 20:22:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EoQbm-0002Tx-8r for ged-emacs-devel@m.gmane.org; Mon, 19 Dec 2005 14:23:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EoQbb-0002TQ-M6 for emacs-devel@gnu.org; Mon, 19 Dec 2005 14:23:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EoQbX-0002QV-QN for emacs-devel@gnu.org; Mon, 19 Dec 2005 14:23:31 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EoQbX-0002QS-LY for emacs-devel@gnu.org; Mon, 19 Dec 2005 14:23:27 -0500 Original-Received: from [68.142.224.81] (helo=web51011.mail.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.34) id 1EoQeX-0007ZL-5n for emacs-devel@gnu.org; Mon, 19 Dec 2005 14:26:33 -0500 Original-Received: (qmail 31868 invoked by uid 60001); 19 Dec 2005 19:22:08 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=kEFL+4HzLUI4wFSA+Qtg6CVbim3pHzTbFjhQq95VUf19mOWuPhGUyRqR8ybdxXug+KSlr1l+GLzwepfU62WJnEYQTRzzpyhupTgTO/lB9NBX3MYbBJBJrM+038nxEOni3llG2BFn/TQqCeqGbWwTyrGBTUdT52i/5ttvUFXlj/I= ; Original-Received: from [207.167.42.60] by web51011.mail.yahoo.com via HTTP; Mon, 19 Dec 2005 11:22:08 PST Original-To: emacs-devel@gnu.org In-Reply-To: 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:48050 Archived-At: --0-1507877980-1135020128=:31350 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Content-Id: Content-Disposition: inline "Richard M. Stallman" wrote: > It looks like this code extracts the list of frame parameter names > when it is _loaded_. That is inconvenient. Could you > do that when the function is called for the first time? ... > replace-regexp is meant for users; could you please write a simple > while loop instead? Sure, this version fixes both concerns. -- Kevin __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --0-1507877980-1135020128=:31350 Content-Type: text/x-emacs-lisp; name="describe-frame-parameter.el" Content-Description: 2803423440-describe-frame-parameter.el Content-Disposition: inline; filename="describe-frame-parameter.el" (defvar frame-parameter-docstring-alist nil "List of (PARAMETER . DOC-STRING) associations.") (defun default-frame-parameter-docstring-alist () "Return the default value of `frame-parameter-docstring-alist'." (save-excursion (save-window-excursion (let ((alist '()) (pop-up-frames nil)) (info "(elisp)Window Frame Parameters") (goto-char (point-min)) (while (re-search-forward "^`\\(\\sw\\(?:\\sw\\|\\s_\\)*\\)'$" nil t) (let* ((parameter (intern (match-string 1))) (infostring (buffer-substring (1+ (point)) (1- (or (re-search-forward "^`" nil t) (point-max))))) (case-fold-search t) (xref-regexp "\\(?: (\\|; see \\)?\\*note[ \t\n]*\\(?:[^:]*\\)::[).]") (xref-or-indent-regexp (format "\\(%s\\)\\|\\(\n +\\)" xref-regexp)) (docstring ;; delete Info xrefs and indentation, then reformat: (with-temp-buffer (insert infostring) (goto-char (point-min)) (while (re-search-forward xref-or-indent-regexp nil t) (cond ((and (match-beginning 1) (match-end 1)) (replace-match "" t t)) ((and (match-beginning 2) (match-end 2)) (replace-match "\n" t t)))) (fill-region (point-min) (point-max)) (buffer-string)))) (setq alist (cons (cons parameter docstring) alist)) ;; move to matched backquote at bol: (backward-char 1))) (nreverse alist))))) (defun describe-frame-parameter (parameter &optional frame) "Display the full documentation of frame PARAMETER (a symbol) in FRAME. If FRAME is nil, describe the selected frame's parameter value." (interactive (let* ((enable-recursive-minibuffers t) (default-param (symbol-at-point)) ;; in Emacs 21.4 there are 41 documented frame parameters; 83 ;; is the smallest prime that's at least twice that: (param-table (let ((table (make-vector 83 0))) (mapc (lambda (assoc) (intern (symbol-name (car assoc)) table)) (or frame-parameter-docstring-alist (setq frame-parameter-docstring-alist (default-frame-parameter-docstring-alist)))) (mapc (lambda (assoc) (intern (symbol-name (car assoc)) table)) (frame-parameters nil)) table)) (param-name (progn ;; make sure the default is a frame parameter: (setq default-param (intern-soft (symbol-name default-param) param-table)) ;; complete on both documented frame parameters and ;; user-defined parameters that may be set: (completing-read (if default-param (format "Describe parameter (default %s): " default-param) "Describe parameter: ") param-table nil t nil nil (if default-param (symbol-name default-param)))))) (list (if (equal param-name "") default-param (intern param-name))))) (if (null frame) (setq frame (selected-frame))) (if (null parameter) (message "You did not specify a frame parameter") (let ((value (frame-parameter frame parameter)) (docstring (cdr (assq parameter frame-parameter-docstring-alist)))) (with-output-to-temp-buffer "*Help*" (prin1 parameter) (princ "'s value is ") (terpri) (with-current-buffer standard-output (let ((from (point))) (pp value) ;; (help-xref-on-pp from (point)) (if (< (point) (+ from 20)) (save-excursion (goto-char from) (delete-char -1))))) (terpri) (terpri) (princ "Documentation:") (terpri) (if docstring (princ docstring) (princ "not documented as a frame parameter.")))))) --0-1507877980-1135020128=:31350 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 --0-1507877980-1135020128=:31350--