Skip to content

Commit

Permalink
Fix mode symbol lookup using info-lookup-symbol and help-goto-info.
Browse files Browse the repository at this point in the history
The mode was not previously providing a mapping between mode symbols
and their location in the Info manual.  This change adds this mapping
allowing info-lookup-symbol and help-goto-info to work with the
symbols documented in the manual.

Additionally, the formatting of user options in the manual has been
changed to be consistent with how they are documented in the Emacs
manual.
  • Loading branch information
brownts committed Aug 13, 2023
1 parent 9751bdf commit 2e4f897
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 68 deletions.
50 changes: 26 additions & 24 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ With the default configuration, the first time gpr-ts-mode is loaded
download, build and install the grammar library. The following
settings provide control over this activity.

#+VINDEX: gpr-ts-mode-grammar
- ~gpr-ts-mode-grammar~ (default: [[https://github.com/brownts/tree-sitter-gpr]]) :: Location
of the tree-sitter GPR language grammar to be used by gpr-ts-mode.
#+VINDEX: gpr-ts-mode-grammar-install
- ~gpr-ts-mode-grammar-install~ (default: ~prompt~) :: Controls the level of
automation in installing the grammar library (automatic, prompt first,
etc).
- User Option: gpr-ts-mode-grammar ::
Location of the tree-sitter GPR language grammar to be used by
gpr-ts-mode.

- User Option: gpr-ts-mode-grammar-install ::
Controls the level of automation in installing the grammar library
(automatic, prompt first, etc).

In order to build the library, you will need to have a C compiler
installed. Refer to the Emacs documentation surrounding
Expand Down Expand Up @@ -172,19 +172,20 @@ construct spanning multiple lines (i.e., broken indent). The
following configurations can be used to customize these indentation
levels to match your own style.

#+VINDEX: gpr-ts-mode-indent-offset
- ~gpr-ts-mode-indent-offset~ (default: 3) :: Indentation used for
structural visualization
#+VINDEX: gpr-ts-mode-indent-when-offset
- ~gpr-ts-mode-indent-when-offset~ (default: 3) :: Indentation for case
items and comments, relative to a case construction.
#+VINDEX: gpr-ts-mode-indent-broken-offset
- ~gpr-ts-mode-indent-broken-offset~ (default: 2) :: Continuation
indentation when item does not completely reside on a single line.
#+VINDEX: gpr-ts-mode-indent-exp-item-offset
- ~gpr-ts-mode-indent-exp-item-offset~ (default: 2) :: Continuation
indentation for partial expressions (i.e., terms, concatenation,
etc).
- User Option: gpr-ts-mode-indent-offset ::
Indentation used for structural visualization

- User Option: gpr-ts-mode-indent-when-offset ::
Indentation for case items and comments, relative to a case
construction.

- User Option: gpr-ts-mode-indent-broken-offset ::
Continuation indentation when item does not completely reside on a
single line.

- User Option: gpr-ts-mode-indent-exp-item-offset ::
Continuation indentation for partial expressions (i.e., terms,
concatenation, etc).

It should be noted that the settings above are defined in terms of
each other, so that by customizing the standard indentation offset
Expand Down Expand Up @@ -230,10 +231,11 @@ instead. This repurposing of function to project/package is also
extended to =which-function-mode= support and will show the current
project and package in the mode line, when enabled.

#+KINDEX: C-M-a
- =C-M-a= :: Move backward to beginning of package or project
#+KINDEX: C-M-e
- =C-M-e= :: Move forward to next end of package or project
- Key: C-M-a (treesit-beginning-of-defun) ::
Move backward to beginning of package or project

- Key: C-M-e (treesit-end-of-defun) ::
Move forward to next end of package or project

With the provided Imenu support, additional options are available for
ease of navigation within a single GPR file. Packages, projects, type
Expand Down
76 changes: 33 additions & 43 deletions doc/gpr-ts-mode.texi
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,15 @@ With the default configuration, the first time gpr-ts-mode is loaded
download, build and install the grammar library. The following
settings provide control over this activity.

@vindex gpr-ts-mode-grammar
@table @asis
@item @code{gpr-ts-mode-grammar} (default: @uref{https://github.com/brownts/tree-sitter-gpr})
Location
of the tree-sitter GPR language grammar to be used by gpr-ts-mode.
@end table
@vindex gpr-ts-mode-grammar-install
@table @asis
@item @code{gpr-ts-mode-grammar-install} (default: @code{prompt})
Controls the level of
automation in installing the grammar library (automatic, prompt first,
etc).
@end table
@defopt gpr-ts-mode-grammar
Location of the tree-sitter GPR language grammar to be used by
gpr-ts-mode.
@end defopt

@defopt gpr-ts-mode-grammar-install
Controls the level of automation in installing the grammar library
(automatic, prompt first, etc).
@end defopt

In order to build the library, you will need to have a C compiler
installed. Refer to the Emacs documentation surrounding
Expand Down Expand Up @@ -250,31 +246,24 @@ construct spanning multiple lines (i.e., broken indent). The
following configurations can be used to customize these indentation
levels to match your own style.

@vindex gpr-ts-mode-indent-offset
@table @asis
@item @code{gpr-ts-mode-indent-offset} (default: 3)
Indentation used for
structural visualization
@end table
@vindex gpr-ts-mode-indent-when-offset
@table @asis
@item @code{gpr-ts-mode-indent-when-offset} (default: 3)
Indentation for case
items and comments, relative to a case construction.
@end table
@vindex gpr-ts-mode-indent-broken-offset
@table @asis
@item @code{gpr-ts-mode-indent-broken-offset} (default: 2)
Continuation
indentation when item does not completely reside on a single line.
@end table
@vindex gpr-ts-mode-indent-exp-item-offset
@table @asis
@item @code{gpr-ts-mode-indent-exp-item-offset} (default: 2)
Continuation
indentation for partial expressions (i.e., terms, concatenation,
etc).
@end table
@defopt gpr-ts-mode-indent-offset
Indentation used for structural visualization
@end defopt

@defopt gpr-ts-mode-indent-when-offset
Indentation for case items and comments, relative to a case
construction.
@end defopt

@defopt gpr-ts-mode-indent-broken-offset
Continuation indentation when item does not completely reside on a
single line.
@end defopt

@defopt gpr-ts-mode-indent-exp-item-offset
Continuation indentation for partial expressions (i.e., terms,
concatenation, etc).
@end defopt

It should be noted that the settings above are defined in terms of
each other, so that by customizing the standard indentation offset
Expand Down Expand Up @@ -321,14 +310,15 @@ instead. This repurposing of function to project/package is also
extended to @samp{which-function-mode} support and will show the current
project and package in the mode line, when enabled.

@kindex C-M-a
@table @asis
@item @samp{C-M-a}
@item @kbd{C-M-a} (@code{treesit-beginning-of-defun})
@kindex C-M-a
@findex treesit-beginning-of-defun
Move backward to beginning of package or project
@end table

@item @kbd{C-M-e} (@code{treesit-end-of-defun})
@kindex C-M-e
@table @asis
@item @samp{C-M-e}
@findex treesit-end-of-defun
Move forward to next end of package or project
@end table

Expand Down
9 changes: 8 additions & 1 deletion gpr-ts-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

;; Author: Troy Brown <[email protected]>
;; Created: February 2023
;; Version: 0.5.3
;; Version: 0.5.4
;; Keywords: gpr gnat ada languages tree-sitter
;; URL: https://github.com/brownts/gpr-ts-mode
;; Package-Requires: ((emacs "29.1"))
Expand Down Expand Up @@ -34,6 +34,7 @@

;;; Code:

(require 'info-look)
(require 'lisp-mnt)
(require 'treesit)
(eval-when-compile (require 'rx))
Expand Down Expand Up @@ -621,6 +622,12 @@ Return nil if there is no name or if NODE is not a defun node."
`(,(rx (or ".gpr" ".cgpr") eos) . gpr-ts-mode))
(add-to-list 'major-mode-remap-alist '(gpr-mode . gpr-ts-mode)))

(info-lookup-add-help
:topic 'symbol
:mode '(emacs-lisp-mode . "gpr")
:regexp "\\bgpr-ts-[^][()`'‘’,\" \t\n]+"
:doc-spec '(("(gpr-ts-mode)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)")))

(provide 'gpr-ts-mode)

;;; gpr-ts-mode.el ends here

0 comments on commit 2e4f897

Please sign in to comment.