unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* getting help for your guile libraries in emacs
@ 2007-11-25 18:16 Andy Wingo
  2007-11-25 18:40 ` Andy Wingo
  2007-12-19 13:29 ` Thien-Thi Nguyen
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Wingo @ 2007-11-25 18:16 UTC (permalink / raw)
  To: guile-user

Greets,

I just discovered an emacs trick that many of you probably know about,
but I figured it's work putting it out there.

Perhaps you have heard of C-h S, which is info-lookup-symbol. It opens
texinfo documentation for the symbol at point. However this isn't very
useful for me for two reasons.

The first reason is that the the info files that are installed in my
system are outdated -- I would want docs for CVS guile rather than 1.6,
for example. The second reason is that often I want docs for libraries
that aren't a base part of Guile, for example g-wrap or guile-gnome-gtk.

Fortunately both of these problems have solutions!

In your .emacs:

    (setq scheme-mode-doc-specs nil)

    (setq Info-additional-directory-list
          (list "~/src/guile-1.8/doc/ref"
                "~/src/guile-1.8/doc/goops"))
    (setq scheme-mode-doc-specs
          '(("(guile)Procedure Index" nil "^ -+ .*: " " ")
            ("(guile)Variable Index" nil "^ -+ .*: " " ")
            ("(guile)R5RS Index" nil "^ -+ .*: " " ")
            ("(goops)Function and Variable Index" nil "^ -+ .*: " " ")))

    (info-lookup-add-help
     :mode 'scheme-mode
     :regexp "[^()`',\" \t\n]+"
     :ignore-case nil
     :doc-spec scheme-mode-doc-specs)

This tells emacs that if it doesn't find an info file in the normal dirs
(set via INFOPATH or via the standard install preferences, such as
/usr/share/info), that it should look for info files in the
Info-additional-directory-list. Then, it says that when programming in
scheme-mode, to lookup help from the three indices in guile.info, and
the one from goops.info.

If you want to add other projects to this set, it is easy. For example,
put the following in your .emacs before the info-lookup-add-help line to
add info-lookup support for programming in guile-gnome:

    ;; Change this to nil if you use installed info files
    (setq guile-gnome-platform-dir "~/src/guile-gnome/platform/")

    (setq guile-gnome-platform-doc-paths
          '("glib/doc/gobject"
            "glib/doc/glib"
            "atk/doc"
            "pango/doc/pango"
            "pango/doc/pangocairo"
            "gtk/doc/gdk"
            "gtk/doc/gtk"
            "libglade/doc"
            "gnome-vfs/doc"
            "libgnome/doc"
            "libgnomeui/doc"
            "libgnomecanvas/doc"
            "gconf/doc"))

    (setq guile-gnome-platform-doc-names
          (mapcar
           (lambda (x)
             (string-match "^\\([a-z0-9-]+\\)/doc/?\\([a-z0-9-]+\\)?$" x)
             (or (match-string 2 x) (match-string 1 x)))
           guile-gnome-platform-doc-paths))

    (if guile-gnome-platform-dir
        (nconc Info-additional-directory-list
               (mapcar
                (lambda (path)
                  (concat guile-gnome-platform-dir path))
                guile-gnome-platform-docs)))
    (nconc scheme-mode-doc-specs
           (mapcan
            (lambda (wrapset)
              (list (list (concat "(guile-gnome-" wrapset ")Type Index") nil
                          "^ -+ .*: " " ")
                    (list (concat "(guile-gnome-" wrapset ")Function Index") nil
                          "^ -+ .*: " " ")))
            guile-gnome-platform-doc-names))

Pretty sweet. I hope this has helped someone, I know that it has helped
me. If you have other nifty hacks, please reply with some code snippets!

Peace,

Andy.

note: the index names of guile-gnome correspond to indices in as-yet
unreleased versions of guile-gnome; change them to the name of the
index nodes in the versions you have if you are interested in such
things
-- 
http://wingolog.org/


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: getting help for your guile libraries in emacs
  2007-11-25 18:16 getting help for your guile libraries in emacs Andy Wingo
@ 2007-11-25 18:40 ` Andy Wingo
  2007-12-19 13:29 ` Thien-Thi Nguyen
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Wingo @ 2007-11-25 18:40 UTC (permalink / raw)
  To: guile-user

On Sun 25 Nov 2007 19:16, Andy Wingo <wingo@pobox.com> writes:

> In your .emacs:

So, turns out there was a typo, a missing definition for mapcan (?), and
a lack of a require statement. Try this:

    (require 'info-look)
    (setq scheme-mode-doc-specs nil)

    (setq Info-additional-directory-list
          (list "~/src/guile-1.8/doc/ref"
                "~/src/guile-1.8/doc/goops"))
    (setq scheme-mode-doc-specs
          '(("(guile)Procedure Index" nil "^ -+ .*: " " ")
            ("(guile)Variable Index" nil "^ -+ .*: " " ")
            ("(guile)R5RS Index" nil "^ -+ .*: " " ")
            ("(goops)Function and Variable Index" nil "^ -+ .*: " " ")))

    (setq guile-gnome-platform-dir "~/src/guile-gnome/platform/")
    (setq guile-gnome-platform-doc-paths
          '("glib/doc/gobject"
            "glib/doc/glib"
            "atk/doc"
            "pango/doc/pango"
            "pango/doc/pangocairo"
            "gtk/doc/gdk"
            "gtk/doc/gtk"
            "libglade/doc"
            "gnome-vfs/doc"
            "libgnome/doc"
            "libgnomeui/doc"
            "libgnomecanvas/doc"
            "gconf/doc"))

    (setq guile-gnome-platform-doc-names
          (mapcar
           (lambda (x)
             (string-match "^\\([a-z0-9-]+\\)/doc/?\\([a-z0-9-]+\\)?$" x)
             (or (match-string 2 x) (match-string 1 x)))
           guile-gnome-platform-doc-paths))

    (if guile-gnome-platform-dir
        (nconc Info-additional-directory-list
               (mapcar
                (lambda (path)
                  (concat guile-gnome-platform-dir path))
                guile-gnome-platform-doc-paths)))
    (defun mapcan (f l) (apply 'nconc (mapcar f l)))
    (nconc scheme-mode-doc-specs
           (mapcan
            (lambda (wrapset)
              (list (list (concat "(guile-gnome-" wrapset ")Type Index") nil
                          "^ -+ .*: " " ")
                    (list (concat "(guile-gnome-" wrapset ")Function Index") nil
                          "^ -+ .*: " " ")))
            guile-gnome-platform-doc-names))

    (info-lookup-add-help
     :mode 'scheme-mode
     :regexp "[^()`',\" \t\n]+"
     :ignore-case nil
     :doc-spec scheme-mode-doc-specs)

Cheers,

Andy
-- 
http://wingolog.org/


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: getting help for your guile libraries in emacs
  2007-11-25 18:16 getting help for your guile libraries in emacs Andy Wingo
  2007-11-25 18:40 ` Andy Wingo
@ 2007-12-19 13:29 ` Thien-Thi Nguyen
  2007-12-19 16:54   ` Thien-Thi Nguyen
  1 sibling, 1 reply; 4+ messages in thread
From: Thien-Thi Nguyen @ 2007-12-19 13:29 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-user

() Andy Wingo <wingo@pobox.com>
() Sun, 25 Nov 2007 19:16:40 +0100

   '(("(guile)Procedure Index" nil "^ -+ .*: " " ")
     ("(guile)Variable Index" nil "^ -+ .*: " " ")
     ("(guile)R5RS Index" nil "^ -+ .*: " " ")
     ("(goops)Function and Variable Index" nil "^ -+ .*: " " "))

cool, thanks for unearthing this.  unfortunately, these specs
do not work for me.  i had to modify these locally like so:

'(("(guile) Procedure Index" nil "^\\* " ":")
  ("(guile) Variable Index" nil "^\\* " ":")
  ("(guile) R5RS Index" nil "^\\* " ":"))

also, during the futzing around required to find this,
i found it a good idea to `(setq info-lookup-cache nil)'
after changing things to avoid confusing Info.

thi


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: getting help for your guile libraries in emacs
  2007-12-19 13:29 ` Thien-Thi Nguyen
@ 2007-12-19 16:54   ` Thien-Thi Nguyen
  0 siblings, 0 replies; 4+ messages in thread
From: Thien-Thi Nguyen @ 2007-12-19 16:54 UTC (permalink / raw)
  To: guile-user

() Thien-Thi Nguyen <ttn@gnuvola.org>
() Wed, 19 Dec 2007 14:29:44 +0100

   () Andy Wingo <wingo@pobox.com>
   () Sun, 25 Nov 2007 19:16:40 +0100

      '(("(guile)Procedure Index" nil "^ -+ .*: " " ")
        ("(guile)Variable Index" nil "^ -+ .*: " " ")
        ("(guile)R5RS Index" nil "^ -+ .*: " " ")
        ("(goops)Function and Variable Index" nil "^ -+ .*: " " "))

   cool, thanks for unearthing this.  unfortunately, these specs
   do not work for me.  i had to modify these locally like so:

   '(("(guile) Procedure Index" nil "^\\* " ":")
     ("(guile) Variable Index" nil "^\\* " ":")
     ("(guile) R5RS Index" nil "^\\* " ":"))

oops, looks like i foolishly confused myself and posted bad code.
the original formulation as posted by Andy Wingo works as advertized.
sorry for the noise.

thi


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

end of thread, other threads:[~2007-12-19 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-25 18:16 getting help for your guile libraries in emacs Andy Wingo
2007-11-25 18:40 ` Andy Wingo
2007-12-19 13:29 ` Thien-Thi Nguyen
2007-12-19 16:54   ` Thien-Thi Nguyen

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).