all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Build-completion using imenu search hits
@ 2009-05-25 14:44 Nordlöw
  2009-05-25 16:14 ` hugo
  2009-05-25 17:08 ` Drew Adams
  0 siblings, 2 replies; 3+ messages in thread
From: Nordlöw @ 2009-05-25 14:44 UTC (permalink / raw)
  To: help-gnu-emacs

How can I programmatically access the hits from the search done by
imenu using for example

(defconst bjam-imenu-generic-expression
  `(
    ("Executables" ,(concat "^\\(exe\\)" "[[:space:]\n]+" "\\([A-Za-
z0-9_/.]+\\)" "[[:space:]\n]+" ":") 2)
    ("Libraries" ,(concat "^\\(lib\\)" "[[:space:]\n]+" "\\([A-Za-
z0-9_/.]+\\)" "[[:space:]\n]+" ":") 2)
    ("Projects" ,(concat "^\\(project\\)" "[[:space:]\n]+" "\\([A-Za-
z0-9_/.]+\\)" "[[:space:]\n]+" ":") 2)

    ;; http://www.boost.org/doc/libs/1_38_0/doc/html/bbv2/tasks.html#bbv2.reference.precompiled_headers
    ("Precompiled C Headers" "^c-pch[[:space:]\n]+\\([A-Za-z0-9_/.]+\\)
[[:space:]\n]+:" 1)
    ("Precompiled C++ Headers" "^cpp-pch[[:space:]\n]+\\([A-Za-z0-9_/.]
+\\)[[:space:]\n]+:" 1)

    ("Rules" "^rule[[:space:]\n]+\\([A-Za-z0-9_]+\\)" 1)
    ("Actions" "^actions[[:space:]\n]+\\([A-Za-z0-9_]+\\)" 1)
    )
  "Imenu generic expression for BJam mode.  See `imenu-generic-
expression'.")
;; Use: (nth 1 (assoc "Executables" bjam-imenu-generic-expression))

in bjam-mode.el. I wan't to use this to provide build/clean target
completion from the menu.

Thanks in advance,
Per Nordlöw


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

* Re: Build-completion using imenu search hits
  2009-05-25 14:44 Build-completion using imenu search hits Nordlöw
@ 2009-05-25 16:14 ` hugo
  2009-05-25 17:08 ` Drew Adams
  1 sibling, 0 replies; 3+ messages in thread
From: hugo @ 2009-05-25 16:14 UTC (permalink / raw)
  To: help-gnu-emacs

On 25 maio, 11:44, Nordlöw <per.nord...@gmail.com> wrote:
> How can I programmatically access the hits from the search done by
> imenu using for example
>
> (defconst bjam-imenu-generic-expression
>   `(
>     ("Executables" ,(concat "^\\(exe\\)" "[[:space:]\n]+" "\\([A-Za-
> z0-9_/.]+\\)" "[[:space:]\n]+" ":") 2)
>     ("Libraries" ,(concat "^\\(lib\\)" "[[:space:]\n]+" "\\([A-Za-
> z0-9_/.]+\\)" "[[:space:]\n]+" ":") 2)
>     ("Projects" ,(concat "^\\(project\\)" "[[:space:]\n]+" "\\([A-Za-
> z0-9_/.]+\\)" "[[:space:]\n]+" ":") 2)
>
>     ;;http://www.boost.org/doc/libs/1_38_0/doc/html/bbv2/tasks.html#bbv2.re...
>     ("Precompiled C Headers" "^c-pch[[:space:]\n]+\\([A-Za-z0-9_/.]+\\)
> [[:space:]\n]+:" 1)
>     ("Precompiled C++ Headers" "^cpp-pch[[:space:]\n]+\\([A-Za-z0-9_/.]
> +\\)[[:space:]\n]+:" 1)
>
>     ("Rules" "^rule[[:space:]\n]+\\([A-Za-z0-9_]+\\)" 1)
>     ("Actions" "^actions[[:space:]\n]+\\([A-Za-z0-9_]+\\)" 1)
>     )
>   "Imenu generic expression for BJam mode.  See `imenu-generic-
> expression'.")
> ;; Use: (nth 1 (assoc "Executables" bjam-imenu-generic-expression))
>
> in bjam-mode.el. I wan't to use this to provide build/clean target
> completion from the menu.
>
> Thanks in advance,
> Per Nordlöw

Search for imeny on this Anything config:

http://www.emacswiki.org/emacs/anything-config.el

Cheers
Hugo


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

* RE: Build-completion using imenu search hits
  2009-05-25 14:44 Build-completion using imenu search hits Nordlöw
  2009-05-25 16:14 ` hugo
@ 2009-05-25 17:08 ` Drew Adams
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2009-05-25 17:08 UTC (permalink / raw)
  To: 'Nordlöw', help-gnu-emacs

> How can I programmatically access the hits from the search done by imenu

`icicle-imenu' does what you want. If you want something similar, look at its
code, including the code for its more generic parent function, `icicle-search'.

Basically, use the imenu regexp to parse the buffer, giving you hit strings and
their locations. Use an alist of such hit+location pairs as the COLLECTION arg
for `completing-read'. Given the chosen hit string, look up the location and go
there.





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

end of thread, other threads:[~2009-05-25 17:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-25 14:44 Build-completion using imenu search hits Nordlöw
2009-05-25 16:14 ` hugo
2009-05-25 17:08 ` Drew Adams

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.