unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* info-look
@ 2006-06-27  6:26 martin rudalics
  2006-06-27 16:16 ` info-look Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2006-06-27  6:26 UTC (permalink / raw)


Please consider the following patch for `info-look.el'.  It's primary
aim is to permit manual lookups directly from

- single-quoted symbol names as found in Elisp doc-strings, and

- symbol names in help-buffers and custom-buffers, including unlispified
  tag names of customizable variables.

2006-06-27  Martin Rudalics  <rudalics@gmx.at>

	* info-look.el (info-lookup-guess-custom-symbol): New function
	for retrieving symbol at point in custom buffers.
	(info-lookup-maybe-add-help): Add backquote and comma to ignored
	characters in regexps of help specifications for emacs-lisp-mode
	and lisp-interaction-mode.  Add specifications for custom-mode
	and help-mode.


*** info-look.el	Tue Apr 11 16:23:50 2006
--- info-look.el	Wed Jun  7 15:45:44 2006
***************
*** 566,571 ****
--- 566,610 ----
  	       (concat prefix name))))
      (error nil)))

+ (defun info-lookup-guess-custom-symbol ()
+   "Get symbol at point in custom buffers."
+   (condition-case nil
+       (save-excursion
+ 	(let* ((case-fold-search t)
+ 	       (ignored-chars "][()`',:.\" \t\n")
+ 	       (significant-chars (concat "^" ignored-chars))
+ 	      beg end)
+ 	  (cond
+ 	   ((and (memq (get-char-property (point) 'face)
+ 		       '(custom-variable-tag custom-variable-tag-face))
+ 		 (setq beg (previous-single-char-property-change
+ 			    (point) 'face nil (line-beginning-position)))
+ 		 (setq end (next-single-char-property-change
+ 			    (point) 'face nil (line-end-position)))
+ 		 (> end beg))
+ 	    (subst-char-in-string
+ 	     ?\ ?\- (buffer-substring-no-properties beg end)))
+ 	   ((or (and (looking-at (concat "[" significant-chars "]"))
+ 		     (save-excursion
+ 		       (skip-chars-backward significant-chars)
+ 		       (setq beg (point)))
+ 		     (skip-chars-forward significant-chars)
+ 		     (setq end (point))
+ 		     (> end beg))
+ 		(and (looking-at "[ \t\n]")
+ 		     (looking-back (concat "[" significant-chars "]"))
+ 		     (setq end (point))
+ 		     (skip-chars-backward significant-chars)
+ 		     (setq beg (point))
+ 		     (> end beg))
+ 		(and (skip-chars-forward ignored-chars)
+ 		     (setq beg (point))
+ 		     (skip-chars-forward significant-chars)
+ 		     (setq end (point))
+ 		     (> end beg)))
+ 	    (buffer-substring-no-properties beg end)))))
+     (error nil)))
+ 
  ;;;###autoload
  (defun info-complete-symbol (&optional mode)
    "Perform completion on symbol preceding point."
***************
*** 789,795 ****

  (info-lookup-maybe-add-help
   :mode 'emacs-lisp-mode
!  :regexp "[^][()'\" \t\n]+"
   :doc-spec '(;; Commands with key sequences appear in nodes as `foo' and
               ;; those without as `M-x foo'.
               ("(emacs)Command Index"  nil "`\\(M-x[ \t\n]+\\)?" "'")
--- 828,834 ----

  (info-lookup-maybe-add-help
   :mode 'emacs-lisp-mode
!  :regexp "[^][()`',\" \t\n]+"
   :doc-spec '(;; Commands with key sequences appear in nodes as `foo' and
               ;; those without as `M-x foo'.
               ("(emacs)Command Index"  nil "`\\(M-x[ \t\n]+\\)?" "'")
***************
*** 806,812 ****

  (info-lookup-maybe-add-help
   :mode 'lisp-interaction-mode
!  :regexp "[^][()'\" \t\n]+"
   :parse-rule 'ignore
   :other-modes '(emacs-lisp-mode))

--- 845,851 ----

  (info-lookup-maybe-add-help
   :mode 'lisp-interaction-mode
!  :regexp "[^][()`',\" \t\n]+"
   :parse-rule 'ignore
   :other-modes '(emacs-lisp-mode))

***************
*** 912,917 ****
--- 951,968 ----
  	      ;; This gets functions in evaluated classes.  Other
  	      ;; possible patterns don't seem to work too well.
  	      "`" "(")))
+ 
+ (info-lookup-maybe-add-help
+  :mode 'custom-mode
+  :ignore-case t
+  :regexp "[^][()`',:\" \t\n]+"
+  :parse-rule 'info-lookup-guess-custom-symbol
+  :other-modes '(emacs-lisp-mode))
+ 
+ (info-lookup-maybe-add-help
+  :mode 'help-mode
+  :regexp "[^][()`',:\" \t\n]+"
+  :other-modes '(emacs-lisp-mode))
  \f
  (provide 'info-look)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: info-look
  2006-06-27  6:26 info-look martin rudalics
@ 2006-06-27 16:16 ` Richard Stallman
  2006-06-27 22:15   ` info-look martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2006-06-27 16:16 UTC (permalink / raw)
  Cc: emacs-devel

    Please consider the following patch for `info-look.el'.  It's primary
    aim is to permit manual lookups directly from

    - single-quoted symbol names as found in Elisp doc-strings, and

Could you explain what you mean by that?

And what is the purpose of info-lookup-guess-custom-symbol?
Why add it?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: info-look
  2006-06-27 16:16 ` info-look Richard Stallman
@ 2006-06-27 22:15   ` martin rudalics
  2006-06-29 12:58     ` info-look Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2006-06-27 22:15 UTC (permalink / raw)
  Cc: emacs-devel

 >     It's primary aim is to permit manual lookups directly from
 >
 >     - single-quoted symbol names as found in Elisp doc-strings, and
 >
 > Could you explain what you mean by that?

Consider the doc-string of the function `mark' in simple.el.  It
contains the single-quoted symbol name `mark-even-if-inactive'.  Moving
there and typing C-h S RET will get you - if I recall correctly -
something like

"Not documented as a symbol: `mark-even-if-inactive"

`info-lookup-symbol' strips the trailing quote but does not strip the
leading backquote which is inconvenient.

 > And what is the purpose of info-lookup-guess-custom-symbol?
 > Why add it?

Have `custom-unlispify-tag-names' non-nil (the default value), customize
`mark-even-if-inactive', move to the "Mark" in "Mark Even If Inactive",
and type C-h S RET.  Should get you something like

"Not documented as a symbol: Mark"

I don't use "unlispified" tag names, hence I normally don't care about
this.  However, I didn't want to write a patch without handling this
special (albeit standard) case.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: info-look
  2006-06-27 22:15   ` info-look martin rudalics
@ 2006-06-29 12:58     ` Richard Stallman
  2006-07-10  9:05       ` info-look martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2006-06-29 12:58 UTC (permalink / raw)
  Cc: emacs-devel

    `info-lookup-symbol' strips the trailing quote but does not strip the
    leading backquote which is inconvenient.

Now I understand.  I agree, that is a bug, and maybe your fix is right.
It's just the description which was confusing.  I suggest you call
that a "symbol in `...'".

So please install that fix.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: info-look
  2006-06-29 12:58     ` info-look Richard Stallman
@ 2006-07-10  9:05       ` martin rudalics
  2006-07-11  5:50         ` info-look Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2006-07-10  9:05 UTC (permalink / raw)
  Cc: emacs-devel

 >     `info-lookup-symbol' strips the trailing quote but does not strip the
 >     leading backquote which is inconvenient.
 >
 > Now I understand.  I agree, that is a bug, and maybe your fix is right.
 > It's just the description which was confusing.  I suggest you call
 > that a "symbol in `...'".

Do you mean changing the log entry to something like:

	* info-look.el (info-lookup-guess-custom-symbol): New function
	for retrieving symbol at point in custom buffers.
	(top level) <info-lookup-maybe-add-help>: Add backquote and
	comma to ignored characters in regexps of help specifications
	for emacs-lisp-mode and lisp-interaction-mode.  This permits
	looking up symbols in `...' and after a comma.  Add help
	specifications for custom-mode and help-mode.

 > So please install that fix.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: info-look
  2006-07-10  9:05       ` info-look martin rudalics
@ 2006-07-11  5:50         ` Richard Stallman
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2006-07-11  5:50 UTC (permalink / raw)
  Cc: emacs-devel

    Do you mean changing the log entry to something like:

	    * info-look.el (info-lookup-guess-custom-symbol): New function
	    for retrieving symbol at point in custom buffers.
	    (top level) <info-lookup-maybe-add-help>: Add backquote and
	    comma to ignored characters in regexps of help specifications
	    for emacs-lisp-mode and lisp-interaction-mode.  This permits
	    looking up symbols in `...' and after a comma.

Yes.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-07-11  5:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-27  6:26 info-look martin rudalics
2006-06-27 16:16 ` info-look Richard Stallman
2006-06-27 22:15   ` info-look martin rudalics
2006-06-29 12:58     ` info-look Richard Stallman
2006-07-10  9:05       ` info-look martin rudalics
2006-07-11  5:50         ` info-look Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).