* Adding multi-group regexps to align-rules-list
@ 2009-05-20 18:59 Peter Monsson
2009-05-21 13:49 ` Scott Frazer
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Peter Monsson @ 2009-05-20 18:59 UTC (permalink / raw)
To: help-gnu-emacs
Hi NG,
I'm trying to extend verilog mode with an alignment of input and
output ports such that
(
input test,
output test,
input [13:0] gfdgtrg,
output [112:1] dsfsf,
output control
);
becomes
(
input test,
output test,
input [13:0] gfdgtrg,
output [112:1] dsfsf,
output control
);
But I keep getting wrong type argument: integer-or-marker-p on the
group list. I've tried quoting, backtick, cons cells, lists, etc. but
nothing works. The documentation says that lists are allowed in group
and from skimming the source code it seems to be implemented as well.
So what am I doing wrong?
(add-hook 'align-load-hook (lambda ()
(add-to-list 'align-rules-list
'(verilog-port-args
(regexp . "\\(?:in\\|out\\)put\\(?:\\(\\s-+\\)\\
(?:\\[.*\\]\\(\\s-+\\)\\)?\\)")
(group . (1 . (2 . ( 3 . 4))))
(modes . '(verilog-mode))
(repeat . t)))))
Thanks in advance
Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Adding multi-group regexps to align-rules-list
2009-05-20 18:59 Adding multi-group regexps to align-rules-list Peter Monsson
@ 2009-05-21 13:49 ` Scott Frazer
2009-05-22 15:49 ` Johan Bockgård
[not found] ` <mailman.7639.1243007382.31690.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 4+ messages in thread
From: Scott Frazer @ 2009-05-21 13:49 UTC (permalink / raw)
To: help-gnu-emacs
Peter Monsson wrote:
> I'm trying to extend verilog mode with an alignment of input and
> output ports such that
>
> (
> input test,
> output test,
> input [13:0] gfdgtrg,
> output [112:1] dsfsf,
> output control
> );
>
> becomes
>
> (
> input test,
> output test,
> input [13:0] gfdgtrg,
> output [112:1] dsfsf,
> output control
> );
>
> But I keep getting wrong type argument: integer-or-marker-p on the
> group list. I've tried quoting, backtick, cons cells, lists, etc. but
> nothing works. The documentation says that lists are allowed in group
> and from skimming the source code it seems to be implemented as well.
> So what am I doing wrong?
>
> (add-hook 'align-load-hook (lambda ()
> (add-to-list 'align-rules-list
> '(verilog-port-args
> (regexp . "\\(?:in\\|out\\)put\\(?:\\(\\s-+\\)\\
> (?:\\[.*\\]\\(\\s-+\\)\\)?\\)")
> (group . (1 . (2 . ( 3 . 4))))
> (modes . '(verilog-mode))
> (repeat . t)))))
>
Here's what I have (although written long ago when my elisp was more naive):
(defcustom align-verilog-rules-list
`(
(verilog-declaration
(regexp . "\\(logic\\|input\\|output\\|inout\\|wire\\|reg\\)\\(\\s-+[[][^]]+[]]\\|\\)\\(\\s-+\\)\\S-")
(group . (3)))
(verilog-asgn_param
(regexp . "\\(assign\\|parameter\\)\\(\\s-+\\)\\S-")
(group . (2)))
(verilog-assign
(regexp . "\\S-+\\(\\s-*\\)[!=><]+\\(\\s-*\\)\\S-")
(group . (1 2)))
(verilog-ports-no-comment
(regexp . "[.][a-zA-Z0-9_]+\\(\\s-+\\)\\S-")
(group . (1)))
(verilog-ports-comment
(regexp . "[.][a-zA-Z0-9_]+\\(\\s-+\\)\\S-.*\\(\\s-+\\)[/]+")
(group . (1 2)))
)
"Verilog alignment rules."
:type align-rules-list-type
:group 'align)
(defcustom align-exclude-verilog-rules-list
`(
(exc-dq-string
(regexp . "\"\\([^\"\n]+\\)\"")
(repeat . t)
(modes . align-dq-string-modes))
(exc-open-comment
(regexp . ,(function (lambda (end reverse)
(funcall (if reverse 're-search-backward 're-search-forward)
(concat "[^ \t\n\\\\]" (regexp-quote comment-start)
"\\(.+\\)$") end t))))
(modes . align-open-comment-modes))
)
"Verilog alignment exclusion rules."
:type align-exclude-rules-list-type
:group 'align)
(put 'align-verilog-rules-list 'risky-local-variable t)
(put 'align-exclude-verilog-rules-list 'risky-local-variable t)
(add-to-list 'align-dq-string-modes 'verilog-mode)
(add-to-list 'align-open-comment-modes 'verilog-mode)
(defun verilog-extras-hook ()
(setq align-mode-rules-list align-verilog-rules-list)
(setq align-exclude-rules-list align-exclude-verilog-rules-list))
(add-hook 'verilog-mode-hook 'verilog-extras-hook t)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Adding multi-group regexps to align-rules-list
2009-05-20 18:59 Adding multi-group regexps to align-rules-list Peter Monsson
2009-05-21 13:49 ` Scott Frazer
@ 2009-05-22 15:49 ` Johan Bockgård
[not found] ` <mailman.7639.1243007382.31690.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 4+ messages in thread
From: Johan Bockgård @ 2009-05-22 15:49 UTC (permalink / raw)
To: help-gnu-emacs
Peter Monsson <petermonsson@yahoo.dk> writes:
> (regexp . "\\(?:in\\|out\\)put\\(?:\\(\\s-+\\)\\
> (?:\\[.*\\]\\(\\s-+\\)\\)?\\)")
> (group . (1 . (2 . ( 3 . 4))))
(regexp . "\\<\\(?:in\\|out\\)put\\(\\s-+\\)\\(?:\\[.*]\\)?\\(\\s-*\\)")
(group . (1 2))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Adding multi-group regexps to align-rules-list
[not found] ` <mailman.7639.1243007382.31690.help-gnu-emacs@gnu.org>
@ 2009-05-22 19:05 ` Peter Monsson
0 siblings, 0 replies; 4+ messages in thread
From: Peter Monsson @ 2009-05-22 19:05 UTC (permalink / raw)
To: help-gnu-emacs
On May 22, 5:49 pm, bojohan+n...@dd.chalmers.se (Johan Bockgård)
wrote:
> Peter Monsson <petermons...@yahoo.dk> writes:
> > (regexp . "\\(?:in\\|out\\)put\\(?:\\(\\s-+\\)\\
> > (?:\\[.*\\]\\(\\s-+\\)\\)?\\)")
> > (group . (1 . (2 . ( 3 . 4))))
>
> (regexp . "\\<\\(?:in\\|out\\)put\\(\\s-+\\)\\(?:\\[.*]\\)?\\(\\s-*\\)")
> (group . (1 2))
Ahh, now I get it. The wrong type argument: integer-or-marker-p error
comes when the second group doesn't even exist. In your solution the
second group always exists as it can match the empty string and align
that.
Thank you, Johan, for your help and also thanks to Scott for some
inspiration on new stuff to add to the align rules.
Best Regards
Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-22 19:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-20 18:59 Adding multi-group regexps to align-rules-list Peter Monsson
2009-05-21 13:49 ` Scott Frazer
2009-05-22 15:49 ` Johan Bockgård
[not found] ` <mailman.7639.1243007382.31690.help-gnu-emacs@gnu.org>
2009-05-22 19:05 ` Peter Monsson
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).