unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* outline-minor-mode: Did something change
@ 2024-01-08  2:39 T.V Raman
  2024-01-08  7:12 ` Juri Linkov
  2024-01-08 16:56 ` T.V Raman
  0 siblings, 2 replies; 10+ messages in thread
From: T.V Raman @ 2024-01-08  2:39 UTC (permalink / raw)
  To: emacs-devel

I had addedoutline-minor-mode to my eww setup and defined
outline-regexp in eww buffers to be:

"[•0-9]+ "
With point at the front of a line like so:

1 Congressional leaders reach a deal to fund the government, avert a shutdown

(looking-at outline-regexp) returns t.
However outline nav commands like outline-next-visible-heading fail,
they jump to the end of the buffer; turning on outline-mode gets those
working (but of course I dont want to lose eww-mode in eww-buffers:)

--



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: outline-minor-mode: Did something change
  2024-01-08  2:39 outline-minor-mode: Did something change T.V Raman
@ 2024-01-08  7:12 ` Juri Linkov
  2024-01-08 15:42   ` T.V Raman
  2024-01-08 16:56 ` T.V Raman
  1 sibling, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2024-01-08  7:12 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

> I had added outline-minor-mode to my eww setup and defined
> outline-regexp in eww buffers to be:
>
> "[0-9]+ "
> With point at the front of a line like so:
>
> 1 Congressional leaders reach a deal to fund the government, avert a shutdown
>
> (looking-at outline-regexp) returns t.
> However outline nav commands like outline-next-visible-heading fail,
> they jump to the end of the buffer; turning on outline-mode gets those
> working (but of course I dont want to lose eww-mode in eww-buffers:)

I guess this is due to changes in eww and shr a month ago
where the commit d41a5e4b1ba added a new function shr-outline-search,
and the commit d0d9d7f5fa3 turned it on in eww-mode.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: outline-minor-mode: Did something change
  2024-01-08  7:12 ` Juri Linkov
@ 2024-01-08 15:42   ` T.V Raman
  0 siblings, 0 replies; 10+ messages in thread
From: T.V Raman @ 2024-01-08 15:42 UTC (permalink / raw)
  To: juri; +Cc: raman, emacs-devel

I did see that in the git logs -- but couldn't figure out why that
stops outline nav from working; do you know how I can get what I want
in the current setup?



Juri Linkov writes:
 > > I had added outline-minor-mode to my eww setup and defined
 > > outline-regexp in eww buffers to be:
 > >
 > > "[0-9]+ "
 > > With point at the front of a line like so:
 > >
 > > 1 Congressional leaders reach a deal to fund the government, avert a shutdown
 > >
 > > (looking-at outline-regexp) returns t.
 > > However outline nav commands like outline-next-visible-heading fail,
 > > they jump to the end of the buffer; turning on outline-mode gets those
 > > working (but of course I dont want to lose eww-mode in eww-buffers:)
 > 
 > I guess this is due to changes in eww and shr a month ago
 > where the commit d41a5e4b1ba added a new function shr-outline-search,
 > and the commit d0d9d7f5fa3 turned it on in eww-mode.

-- 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* outline-minor-mode: Did something change
  2024-01-08  2:39 outline-minor-mode: Did something change T.V Raman
  2024-01-08  7:12 ` Juri Linkov
@ 2024-01-08 16:56 ` T.V Raman
  2024-01-10  7:16   ` Juri Linkov
  1 sibling, 1 reply; 10+ messages in thread
From: T.V Raman @ 2024-01-08 16:56 UTC (permalink / raw)
  To: raman; +Cc: emacs-devel


Answering my own question after the previous message pointed out the
change in eww:

Adding
(setq outline-level 'outline-level outline-search-function nil)

Restored the behavior I lost
but I dont understand how that commit which adding the shr-specific
searcher broke it.

T.V Raman writes:
 > I had addedoutline-minor-mode to my eww setup and defined
 > outline-regexp in eww buffers to be:
 > 
 > "[•0-9]+ "
 > With point at the front of a line like so:
 > 
 > 1 Congressional leaders reach a deal to fund the government, avert a shutdown
 > 
 > (looking-at outline-regexp) returns t.
 > However outline nav commands like outline-next-visible-heading fail,
 > they jump to the end of the buffer; turning on outline-mode gets those
 > working (but of course I dont want to lose eww-mode in eww-buffers:)
 > 
 > --
 > 

-- 

--

--



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: outline-minor-mode: Did something change
  2024-01-08 16:56 ` T.V Raman
@ 2024-01-10  7:16   ` Juri Linkov
  2024-01-10 15:26     ` T.V Raman
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2024-01-10  7:16 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

> Answering my own question after the previous message pointed out the
> change in eww:
>
> Adding
> (setq outline-level 'outline-level outline-search-function nil)
>
> Restored the behavior I lost
> but I dont understand how that commit which adding the shr-specific
> searcher broke it.

The new function shr-outline-search doesn't use outline-regexp.
It searches for the text property 'outline-level' that the function
'shr-heading' puts on HTML headers.  Then it makes outline headings
only on the lines with HTML headers.  This is a more reliable way
than using a regexp.

However, if you want to make outlines with a specific regexp
what you already did is the right way to do this.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: outline-minor-mode: Did something change
  2024-01-10  7:16   ` Juri Linkov
@ 2024-01-10 15:26     ` T.V Raman
  2024-01-10 18:09       ` T.V Raman
  0 siblings, 1 reply; 10+ messages in thread
From: T.V Raman @ 2024-01-10 15:26 UTC (permalink / raw)
  To: juri; +Cc: raman, emacs-devel


Thanks!

Using  headers is the right idea an the regexp is a hack, but sadly
the entire Web is a hack that forgot the meaning of structure a long,
long time ago!

Juri Linkov writes:
 > > Answering my own question after the previous message pointed out the
 > > change in eww:
 > >
 > > Adding
 > > (setq outline-level 'outline-level outline-search-function nil)
 > >
 > > Restored the behavior I lost
 > > but I dont understand how that commit which adding the shr-specific
 > > searcher broke it.
 > 
 > The new function shr-outline-search doesn't use outline-regexp.
 > It searches for the text property 'outline-level' that the function
 > 'shr-heading' puts on HTML headers.  Then it makes outline headings
 > only on the lines with HTML headers.  This is a more reliable way
 > than using a regexp.
 > 
 > However, if you want to make outlines with a specific regexp
 > what you already did is the right way to do this.

-- 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: outline-minor-mode: Did something change
  2024-01-10 15:26     ` T.V Raman
@ 2024-01-10 18:09       ` T.V Raman
  2024-01-11  7:03         ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: T.V Raman @ 2024-01-10 18:09 UTC (permalink / raw)
  To: juri; +Cc: emacs-devel

"T.V Raman" <raman@google.com> writes:


Only think to add: could we have a half-way house solution that at least
for a while uses both ie outline-level and outline-regexp?

> Thanks!
>
> Using  headers is the right idea an the regexp is a hack, but sadly
> the entire Web is a hack that forgot the meaning of structure a long,
> long time ago!
>
> Juri Linkov writes:
>  > > Answering my own question after the previous message pointed out the
>  > > change in eww:
>  > >
>  > > Adding
>  > > (setq outline-level 'outline-level outline-search-function nil)
>  > >
>  > > Restored the behavior I lost
>  > > but I dont understand how that commit which adding the shr-specific
>  > > searcher broke it.
>  > 
>  > The new function shr-outline-search doesn't use outline-regexp.
>  > It searches for the text property 'outline-level' that the function
>  > 'shr-heading' puts on HTML headers.  Then it makes outline headings
>  > only on the lines with HTML headers.  This is a more reliable way
>  > than using a regexp.
>  > 
>  > However, if you want to make outlines with a specific regexp
>  > what you already did is the right way to do this.

-- 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: outline-minor-mode: Did something change
  2024-01-10 18:09       ` T.V Raman
@ 2024-01-11  7:03         ` Juri Linkov
  2024-01-11 16:36           ` T.V Raman
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2024-01-11  7:03 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

>>> The new function shr-outline-search doesn't use outline-regexp.
>>> It searches for the text property 'outline-level' that the function
>>> 'shr-heading' puts on HTML headers.  Then it makes outline headings
>>> only on the lines with HTML headers.  This is a more reliable way
>>> than using a regexp.
>>>
>>> However, if you want to make outlines with a specific regexp
>>> what you already did is the right way to do this.
>>
>> Using headers is the right idea an the regexp is a hack, but sadly
>> the entire Web is a hack that forgot the meaning of structure a long,
>> long time ago!
>
> Only think to add: could we have a half-way house solution that at least
> for a while uses both ie outline-level and outline-regexp?

outline-regexp is too unreliable: in eww need not to mismatch HTML headers,
in emacs-lisp-mode not to match the open parenthesis in the docstring, etc.
For the same reason tree-sitter is preferable to regexp-based font-lock.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: outline-minor-mode: Did something change
  2024-01-11  7:03         ` Juri Linkov
@ 2024-01-11 16:36           ` T.V Raman
  2024-01-12  7:29             ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: T.V Raman @ 2024-01-11 16:36 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

Juri Linkov <juri@linkov.net> writes:


I' not disagreeing with you; what I was pointing out is that the HTML
Web rejected all notions of structured markup a long time ago, so hoping
that structure alone will give us something useful remains  a dream --
one  that I too dremt  a long time ago

>>>> The new function shr-outline-search doesn't use outline-regexp.
>>>> It searches for the text property 'outline-level' that the function
>>>> 'shr-heading' puts on HTML headers.  Then it makes outline headings
>>>> only on the lines with HTML headers.  This is a more reliable way
>>>> than using a regexp.
>>>>
>>>> However, if you want to make outlines with a specific regexp
>>>> what you already did is the right way to do this.
>>>
>>> Using headers is the right idea an the regexp is a hack, but sadly
>>> the entire Web is a hack that forgot the meaning of structure a long,
>>> long time ago!
>>
>> Only think to add: could we have a half-way house solution that at least
>> for a while uses both ie outline-level and outline-regexp?
>
> outline-regexp is too unreliable: in eww need not to mismatch HTML headers,
> in emacs-lisp-mode not to match the open parenthesis in the docstring, etc.
> For the same reason tree-sitter is preferable to regexp-based font-lock.

-- 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: outline-minor-mode: Did something change
  2024-01-11 16:36           ` T.V Raman
@ 2024-01-12  7:29             ` Juri Linkov
  0 siblings, 0 replies; 10+ messages in thread
From: Juri Linkov @ 2024-01-12  7:29 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

>>>> Using headers is the right idea an the regexp is a hack, but sadly
>>>> the entire Web is a hack that forgot the meaning of structure a long,
>>>> long time ago!
>>>
>>> Only think to add: could we have a half-way house solution that at least
>>> for a while uses both ie outline-level and outline-regexp?
>>
>> outline-regexp is too unreliable: in eww need not to mismatch HTML headers,
>> in emacs-lisp-mode not to match the open parenthesis in the docstring, etc.
>> For the same reason tree-sitter is preferable to regexp-based font-lock.
>
> I' not disagreeing with you; what I was pointing out is that the HTML
> Web rejected all notions of structured markup a long time ago, so hoping
> that structure alone will give us something useful remains  a dream --
> one  that I too dremt  a long time ago

Alas, the idea of the Semantic Web has failed, so to get useful information
from a Web page the remaining way is to resort to Web scraping using regexps.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-01-12  7:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-08  2:39 outline-minor-mode: Did something change T.V Raman
2024-01-08  7:12 ` Juri Linkov
2024-01-08 15:42   ` T.V Raman
2024-01-08 16:56 ` T.V Raman
2024-01-10  7:16   ` Juri Linkov
2024-01-10 15:26     ` T.V Raman
2024-01-10 18:09       ` T.V Raman
2024-01-11  7:03         ` Juri Linkov
2024-01-11 16:36           ` T.V Raman
2024-01-12  7:29             ` Juri Linkov

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).