all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: ~johnmuhl <johnmuhl@git.sr.ht>
Cc: ~johnmuhl <jm@pub.pink>,
	~emacs/emacs-devel@lists.sr.ht, 65672@debbugs.gnu.org
Subject: bug#65672: [PATCH emacs 1/1] Add lua-ts-mode
Date: Sat, 02 Sep 2023 16:10:06 +0200	[thread overview]
Message-ID: <875y4sd5tt.fsf@gmail.com> (raw)
In-Reply-To: <169352253839.28940.16024479871485106701-1@git.sr.ht> (johnmuhl@git.sr.ht's message of "Thu, 31 Aug 2023 16:32:06 -0500")

On Thu, 31 Aug 2023 at 16:32, ~johnmuhl wrote:

> +(defcustom inferior-lua-switches "-i"
> +  "Command line options for the inferior Lua process."
> +  :type 'string
> +  :safe 'stringp
> +  :group 'lua
> +  :version "30.1")

This should be given as a list of strings rather a string that you later
need to call split-string-shell-command on.

Also, I think it's probably best to use the same lua-ts- prefix for the
Lua shell variables and command.  If you're really fond of a
`inferior-lua' or `run-lua' command, it could be an alias (but then one
might need to think about what to do about name clashes when one of the
other Lua modes is installed).

> +(defcustom inferior-lua-startfile ""
> +  "File to load into the inferior Lua process at startup."
> +  :type 'string
> +  :safe 'stringp
> +  :group 'lua
> +  :version "30.1")

This should be nil by default.

> +(defun lua-ts-documentation-at-point ()
> +  "Show documentation of function at point in Lua manual."
> +  (interactive)
> +  (unless (string-blank-p lua-ts-lua-manual)
> +    (let ((character-before (char-to-string (char-before)))
> +          id)
> +      (save-excursion
> +        ;; When point is mid-word `treesit-thing-at-point'
> +        ;; may return the parent node of the thing at point.
> +        (unless (or (bolp)
> +                    (not (string-match-p "[[:alnum:]]" character-before)))
> +          (backward-word))
> +        (let ((node (treesit-thing-at-point 'builtin nil)))
> +          (setq id (pcase (treesit-node-type node)
> +                     ("dot_index_expression" (treesit-node-text node t))
> +                     ("function_call"
> +                      (let* ((child (treesit-node-child-by-field-name node "name"))
> +                             (name (treesit-node-text child t)))
> +                        (if (string-match-p ":" name)
> +                            (replace-regexp-in-string "^.*:" "file:" name)
> +                          name)))))))
> +      (when id (browse-url (concat lua-ts-lua-manual "#pdf-" id))))))

I wouldn't add this command.  It's not polished enough and too ad-hoc in
the sense that this functionality is (or should be) covered by other
mechanisms: Info, Eldoc, etc.

> +    ;; Outline.
> +    (setq-local outline-regexp
> +                (rx (or "--[[" "do" "for" "if" "repeat" "while"
> +                        (seq (** 0 1 "local ") "function"))))

What is the idea behind "--[["?  Should one allow whitespace in front of
these strings (also inferring the outline level from that)?  Also, one
should allow arbitrary whitespace after "local" (I'd say "local\\s-+")
and enclose the keywords with "\\_<...\\_>".

In general, this looks nice, thanks!





  parent reply	other threads:[~2023-09-02 14:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 22:55 bug#65673: [PATCH emacs 0/1] Add lua-ts-mode ~johnmuhl
2023-08-31 21:32 ` bug#65672: [PATCH emacs 1/1] " ~johnmuhl
2023-09-02 12:14   ` bug#65673: [PATCH emacs 0/1] " Philip Kaludercic
2023-09-02 14:10   ` Augusto Stoffel [this message]
     [not found]   ` <handler.65672.B.169354983214451.ack@debbugs.gnu.org>
2023-09-04 14:36     ` bug#65672: [PATCH emacs 1/1] " john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 15:18       ` Eli Zaretskii
2023-09-04 15:54       ` Philip Kaludercic
2023-09-01 22:46 ` bug#65673: [PATCH emacs 0/1] " Mauro Aranda
2023-09-09 15:17 ` bug#65673: [PATCH emacs 1/1 v2] " john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-09 15:17   ` bug#65673: [PATCH] " john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-10 11:12     ` Philip Kaludercic
2023-09-10 12:57       ` Augusto Stoffel
2023-09-11 15:03 ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-16 10:03   ` Eli Zaretskii
2023-09-16 11:17     ` Eli Zaretskii
2023-09-16 11:21       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875y4sd5tt.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=65672@debbugs.gnu.org \
    --cc=jm@pub.pink \
    --cc=johnmuhl@git.sr.ht \
    --cc=~emacs/emacs-devel@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.