Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.emacs.help > #60770
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | gnu.emacs.help |
| Subject | Re: Howto modify syntax entry for "[" and "]" in elisp mode? |
| Date | 2023-05-04 20:48 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87ttwrc1y0.fsf@bsb.me.uk> (permalink) |
| References | <6da9bf63-05c3-478f-b36b-39ee8734449fn@googlegroups.com> |
gjlayde <georgjohann@web.de> writes:
> I am using emacs-lisp mode to edit RTL (Register Transfer Language)
> files. I chose elistp because that's close to RTL.
>
> Indentation works fine, except when I have to break very long
> lines. Suppose the following example:
>
> [(set (pc)
> (if_then_else
> (match_operator 0 "ordered_comparison_operator"
> [(match_operand:PSI 1 "register_operand" "r,r,d ,r ,d,r")
> (match_operand:PSI 2 "nonmemory_operand" "L,r,s ,s ,M,n")])
> (label_ref (match_operand 3 "" ""))
> (pc)))
> (clobber (match_scratch:QI 4 "=X,X,&d,&d ,X,&d"))]
>
> What I want is that "[" and "]" basically behave like "(" and ")".
In my emacs-lisp-mode, [ and ] already behave like ( and ) because []s
are used for vectors and must nest correctly with ()s.
> In particular, it appears that indentation of the line starting with
> "[" is far too much and aligns with the next space in the line above.
( does this as well as [. The arguments in a form are lined up with
each other:
(a b
c
(d e))
[a b
c
[d e]]
Otherwise one space indent is used:
(a
b
c
(d
e))
[a
b
c
[d
e]]
(I am ignoring the special case of (def... forms that indent the second
line by an amount you can set).
> So "[" whould indent a fixed amout compared to the line above it.
You could maybe write a indent function which you then use by setting
the variable 'lisp-indent-function' but I can imagine that gets a bit
fussy.
--
Ben.
Back to gnu.emacs.help | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Howto modify syntax entry for "[" and "]" in elisp mode? gjlayde <georgjohann@web.de> - 2023-05-04 10:17 -0700
Re: Howto modify syntax entry for "[" and "]" in elisp mode? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-05-04 20:48 +0100
Re: Howto modify syntax entry for "[" and "]" in elisp mode? gjlayde <georgjohann@web.de> - 2023-05-04 13:12 -0700
Re: Howto modify syntax entry for "[" and "]" in elisp mode? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-05-05 00:44 +0100
Re: Howto modify syntax entry for "[" and "]" in elisp mode? steve g <Sgonedes1977@gmail.com> - 2026-06-24 23:29 -0400
csiph-web