* can shr-start go away?
@ 2024-11-12 1:59 Mike Kupfer
2024-11-12 8:44 ` Andreas Schwab
0 siblings, 1 reply; 6+ messages in thread
From: Mike Kupfer @ 2024-11-12 1:59 UTC (permalink / raw)
To: emacs-devel
shr.el has
(defvar shr-start nil)
But the only place in Emacs that checks the value of shr-start is
shr-tag-a, and shr-tag-a overrides the defvar via a "let" declaration.
shr-tag-img can set shr-start, but it doesn't use shr-start itself.
Am I missing something? (I'm still something of a Lisp newbie.)
If shr-start can indeed go away, I can do that as part of the fix for
bug#60423.
thanks,
mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can shr-start go away?
2024-11-12 1:59 can shr-start go away? Mike Kupfer
@ 2024-11-12 8:44 ` Andreas Schwab
2024-11-12 15:30 ` Mike Kupfer
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2024-11-12 8:44 UTC (permalink / raw)
To: Mike Kupfer; +Cc: emacs-devel
On Nov 11 2024, Mike Kupfer wrote:
> shr-tag-img can set shr-start, but it doesn't use shr-start itself.
shr-tag-img sets it for shr-tag-a.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can shr-start go away?
2024-11-12 8:44 ` Andreas Schwab
@ 2024-11-12 15:30 ` Mike Kupfer
2024-11-12 16:00 ` Andreas Schwab
0 siblings, 1 reply; 6+ messages in thread
From: Mike Kupfer @ 2024-11-12 15:30 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel
Andreas Schwab wrote:
> On Nov 11 2024, Mike Kupfer wrote:
>
> > shr-tag-img can set shr-start, but it doesn't use shr-start itself.
>
> shr-tag-img sets it for shr-tag-a.
That might have been the intent at one time. But shr-tag-a has
(let ((url (dom-attr dom 'href))
(title (dom-attr dom 'title))
(start (point))
shr-start)
Doesn't that create a new binding for shr-start, which means that
shr-tag-a will not see whatever shr-tag-img did? (Apologies if this
seems like a dumb question. Like I wrote, I'm still something of a Lisp
newbie.)
The code has been like this for several releases. It even precedes the
conversion of shr.el to lexical binding.
Maybe I should ask about this on ding?
mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can shr-start go away?
2024-11-12 15:30 ` Mike Kupfer
@ 2024-11-12 16:00 ` Andreas Schwab
2024-11-12 16:45 ` Mike Kupfer
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2024-11-12 16:00 UTC (permalink / raw)
To: Mike Kupfer; +Cc: emacs-devel
On Nov 12 2024, Mike Kupfer wrote:
> That might have been the intent at one time. But shr-tag-a has
>
> (let ((url (dom-attr dom 'href))
> (title (dom-attr dom 'title))
> (start (point))
> shr-start)
It has always been that way.
> Doesn't that create a new binding for shr-start, which means that
> shr-tag-a will not see whatever shr-tag-img did?
No, shr-start has always been declared as special.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can shr-start go away?
2024-11-12 16:00 ` Andreas Schwab
@ 2024-11-12 16:45 ` Mike Kupfer
2024-11-12 16:53 ` Andreas Schwab
0 siblings, 1 reply; 6+ messages in thread
From: Mike Kupfer @ 2024-11-12 16:45 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel
Andreas Schwab wrote:
> No, shr-start has always been declared as special.
Okay, I think I understand the Lisp mechanics now. The 'let' in
shr-tag-a creates a new dynamic binding for shr-start. So as long as
shr-tag-img is called before shr-tag-a returns (i.e., in the context of
shr-tag-a's 'let' form), shr-tag-a will see what shr-tag-img did to
shr-start. Is that correct?
thanks,
mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can shr-start go away?
2024-11-12 16:45 ` Mike Kupfer
@ 2024-11-12 16:53 ` Andreas Schwab
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2024-11-12 16:53 UTC (permalink / raw)
To: Mike Kupfer; +Cc: emacs-devel
On Nov 12 2024, Mike Kupfer wrote:
> Okay, I think I understand the Lisp mechanics now. The 'let' in
> shr-tag-a creates a new dynamic binding for shr-start. So as long as
> shr-tag-img is called before shr-tag-a returns (i.e., in the context of
> shr-tag-a's 'let' form), shr-tag-a will see what shr-tag-img did to
> shr-start. Is that correct?
Yes, that's what dynamic binding is all about.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-11-12 16:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12 1:59 can shr-start go away? Mike Kupfer
2024-11-12 8:44 ` Andreas Schwab
2024-11-12 15:30 ` Mike Kupfer
2024-11-12 16:00 ` Andreas Schwab
2024-11-12 16:45 ` Mike Kupfer
2024-11-12 16:53 ` Andreas Schwab
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).