* How to debug indentation
@ 2018-05-25 2:58 N. Raghavendra
2018-05-25 3:45 ` N. Raghavendra
2018-05-25 5:24 ` Stefan Monnier
0 siblings, 2 replies; 6+ messages in thread
From: N. Raghavendra @ 2018-05-25 2:58 UTC (permalink / raw)
To: emacs-devel
I am trying to debug nXML mode indentation. As a way of seeing what
functions like `nxml-indent-line' and `nxml-compute-indent' do, I am
inserting `message' forms at various places in these functions, and
looking at the *Messages* buffer to see what has happened. However, I
am finding this method cumbersome.
Is there a more systematic way of doing this? Is it possible to use
Edebug to debug indentation? Or any other methods?
Thanks,
Raghu.
--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to debug indentation
2018-05-25 2:58 How to debug indentation N. Raghavendra
@ 2018-05-25 3:45 ` N. Raghavendra
2018-05-25 5:24 ` Stefan Monnier
1 sibling, 0 replies; 6+ messages in thread
From: N. Raghavendra @ 2018-05-25 3:45 UTC (permalink / raw)
To: emacs-devel
At 2018-05-25T08:28:31+05:30, N. Raghavendra wrote:
> I am trying to debug nXML mode indentation. As a way of seeing what
> functions like `nxml-indent-line' and `nxml-compute-indent' do, I am
> inserting `message' forms at various places in these functions, and
> looking at the *Messages* buffer to see what has happened. However, I
> am finding this method cumbersome.
I meant that after inserting the message forms, I open a test XML file,
go to various lines, press TAB, and see the messages that are generated.
> Is there a more systematic way of doing this? Is it possible to use
> Edebug to debug indentation? Or any other methods?
>
> Thanks,
> Raghu.
--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to debug indentation
2018-05-25 2:58 How to debug indentation N. Raghavendra
2018-05-25 3:45 ` N. Raghavendra
@ 2018-05-25 5:24 ` Stefan Monnier
2018-05-25 17:47 ` N. Raghavendra
1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2018-05-25 5:24 UTC (permalink / raw)
To: emacs-devel
> I am trying to debug nXML mode indentation. As a way of seeing what
> functions like `nxml-indent-line' and `nxml-compute-indent' do, I am
> inserting `message' forms at various places in these functions, and
> looking at the *Messages* buffer to see what has happened. However, I
> am finding this method cumbersome.
If the indentation code is spread over several functions,
`trace-function` can be useful as well (along with insertion of
`trace-values` calls).
> Is there a more systematic way of doing this? Is it possible to use
> Edebug to debug indentation?
Yes, I often use Edebug to debug indentation problems.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to debug indentation
2018-05-25 5:24 ` Stefan Monnier
@ 2018-05-25 17:47 ` N. Raghavendra
2018-05-26 1:41 ` Michael Heerdegen
0 siblings, 1 reply; 6+ messages in thread
From: N. Raghavendra @ 2018-05-25 17:47 UTC (permalink / raw)
To: emacs-devel
At 2018-05-25T01:24:01-04:00, Stefan Monnier wrote:
> If the indentation code is spread over several functions,
> `trace-function` can be useful as well (along with insertion of
> `trace-values` calls).
I can see what `trace-function' does, but can't make out how to use
`trace-values'. I saw trace.el, but there is no documentation there
about it. Can you give some idea of how to use it?
> Yes, I often use Edebug to debug indentation problems.
I am now able to use Edebug to see how the indentation is working.
Thanks,
Raghu.
--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to debug indentation
2018-05-25 17:47 ` N. Raghavendra
@ 2018-05-26 1:41 ` Michael Heerdegen
2018-05-26 2:26 ` N. Raghavendra
0 siblings, 1 reply; 6+ messages in thread
From: Michael Heerdegen @ 2018-05-26 1:41 UTC (permalink / raw)
To: emacs-devel
"N. Raghavendra" <nyraghu27132@gmail.com> writes:
> I can see what `trace-function' does, but can't make out how to use
> `trace-values'. I saw trace.el, but there is no documentation there
> about it.
It has a docstring.
> Can you give some idea of how to use it?
AFAICT you just place into in the code, reevaluate, and it will print
values into the trace buffer. E.g.
(defun fac (x)
(trace-values (cons 'x x))
(if (< x 2) 1 (* x (fac (1- x)))))
Tracing `fac' and evaluating (fac 3) gives you a trace buffer like
1 -> (fac 3)
1 -> (trace-values (x . 3))
2 -> (fac 2)
2 -> (trace-values (x . 2))
3 -> (fac 1)
3 -> (trace-values (x . 1))
3 <- fac: 1
2 <- fac: 2
1 <- fac: 6
Nothing more.
Michael.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to debug indentation
2018-05-26 1:41 ` Michael Heerdegen
@ 2018-05-26 2:26 ` N. Raghavendra
0 siblings, 0 replies; 6+ messages in thread
From: N. Raghavendra @ 2018-05-26 2:26 UTC (permalink / raw)
To: emacs-devel
At 2018-05-26T03:41:03+02:00, Michael Heerdegen wrote:
> AFAICT you just place into in the code, reevaluate, and it will print
> values into the trace buffer. E.g.
>
> (defun fac (x)
> (trace-values (cons 'x x))
> (if (< x 2) 1 (* x (fac (1- x)))))
>
> Tracing `fac' and evaluating (fac 3) gives you a trace buffer like
>
> 1 -> (fac 3)
> 1 -> (trace-values (x . 3))
> 2 -> (fac 2)
> 2 -> (trace-values (x . 2))
> 3 -> (fac 1)
> 3 -> (trace-values (x . 1))
> 3 <- fac: 1
> 2 <- fac: 2
> 1 <- fac: 6
>
> Nothing more.
That's helpful. I'll try that.
Thanks,
Raghu.
--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-05-26 2:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-25 2:58 How to debug indentation N. Raghavendra
2018-05-25 3:45 ` N. Raghavendra
2018-05-25 5:24 ` Stefan Monnier
2018-05-25 17:47 ` N. Raghavendra
2018-05-26 1:41 ` Michael Heerdegen
2018-05-26 2:26 ` N. Raghavendra
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.