emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

info-look


From: martin rudalics
Subject: info-look
Date: Tue, 27 Jun 2006 08:26:41 +0200

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  <address@hidden>

        * 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))
  
  (provide 'info-look)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]