user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] hlmod: update for highlight 3.51 API change
@ 2019-09-24 20:05 Alyssa Ross
  2019-09-26  1:59 ` Eric Wong
  0 siblings, 1 reply; 7+ messages in thread
From: Alyssa Ross @ 2019-09-24 20:05 UTC (permalink / raw)
  To: meta; +Cc: Alyssa Ross, Amitai Schleier

Quoting Amitai Schleier, who made this same change in ikiwiki[1],
where lots of the public-inbox highlight code comes from:

> As of 3.51, searchFile() is no longer provided in highlight's Perl
> bindings (at least on NetBSD and OS X, as built from pkgsrc). This
> leaves us falling through to getConfDir(), which has been gone
> rather longer.
>
> From highlight git, it appears searchFile() and getFiletypesConfPath()
> both originated in the 3.14 release. The latter is still available in
> 3.51, and returns the same result searchFile() used to. Switch to it.

So, this should still be compatible with the version of highlight.pm in
Debian, but add support for newer versions as well.

[1]: commit 4d06df9583e6c4145f8c6fc2fd51d7894c0b85ce

Cc: Amitai Schleier <schmonz-web-ikiwiki@schmonz.com>
---
 lib/PublicInbox/HlMod.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/HlMod.pm b/lib/PublicInbox/HlMod.pm
index 36e3110..1d7a460 100644
--- a/lib/PublicInbox/HlMod.pm
+++ b/lib/PublicInbox/HlMod.pm
@@ -20,7 +20,7 @@ use PublicInbox::Hval qw(src_escape ascii_html);
 my $hl;

 sub _parse_filetypes ($) {
-	my $ft_conf = $_[0]->searchFile('filetypes.conf') or
+	my $ft_conf = $_[0]->getFiletypesConfPath('filetypes') or
 				die 'filetypes.conf not found by highlight';
 	open my $fh, '<', $ft_conf or die "failed to open($ft_conf): $!";
 	local $/;
--
2.22.1


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

* Re: [PATCH] hlmod: update for highlight 3.51 API change
  2019-09-24 20:05 [PATCH] hlmod: update for highlight 3.51 API change Alyssa Ross
@ 2019-09-26  1:59 ` Eric Wong
  2019-09-26 13:18   ` Konstantin Ryabitsev
  2019-09-26 15:08   ` [PATCH] hlmod: update for highlight 3.51 API change Alyssa Ross
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Wong @ 2019-09-26  1:59 UTC (permalink / raw)
  To: Alyssa Ross; +Cc: meta, Amitai Schleier

Alyssa Ross <hi@alyssa.is> wrote:
> Quoting Amitai Schleier, who made this same change in ikiwiki[1],
> where lots of the public-inbox highlight code comes from:
> 
> > As of 3.51, searchFile() is no longer provided in highlight's Perl
> > bindings (at least on NetBSD and OS X, as built from pkgsrc). This
> > leaves us falling through to getConfDir(), which has been gone
> > rather longer.
> >
> > From highlight git, it appears searchFile() and getFiletypesConfPath()
> > both originated in the 3.14 release. The latter is still available in
> > 3.51, and returns the same result searchFile() used to. Switch to it.
> 
> So, this should still be compatible with the version of highlight.pm in
> Debian, but add support for newer versions as well.
> 
> [1]: commit 4d06df9583e6c4145f8c6fc2fd51d7894c0b85ce

Thanks both, pushed as dadaf7fd96301f1737b2eca2171a742daef8befd

I had my reservations about relying on highlight.pm; and this
confirms them, unfortunately :<  Oh well...

I wonder if pygments or any other code highlighting packages are
more stable.  We'd need to use a pipe or socket to interact with
pygments or anything w/o Perl bindings.

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

* Re: [PATCH] hlmod: update for highlight 3.51 API change
  2019-09-26  1:59 ` Eric Wong
@ 2019-09-26 13:18   ` Konstantin Ryabitsev
  2019-09-26 15:07     ` Alyssa Ross
  2019-10-08 21:53     ` [PATCH] TODO: add an item for Python pygments Eric Wong
  2019-09-26 15:08   ` [PATCH] hlmod: update for highlight 3.51 API change Alyssa Ross
  1 sibling, 2 replies; 7+ messages in thread
From: Konstantin Ryabitsev @ 2019-09-26 13:18 UTC (permalink / raw)
  To: Eric Wong; +Cc: Alyssa Ross, meta, Amitai Schleier

On Thu, Sep 26, 2019 at 01:59:53AM +0000, Eric Wong wrote:
>I had my reservations about relying on highlight.pm; and this
>confirms them, unfortunately :<  Oh well...

I was also unable to find highlight.pm anywhere outside of Debian 
packages.

>I wonder if pygments or any other code highlighting packages are
>more stable.  We'd need to use a pipe or socket to interact with
>pygments or anything w/o Perl bindings.

I'd be quite happy to be able to use pygments!

Best,
-K

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

* Re: [PATCH] hlmod: update for highlight 3.51 API change
  2019-09-26 13:18   ` Konstantin Ryabitsev
@ 2019-09-26 15:07     ` Alyssa Ross
  2019-10-08 21:53     ` [PATCH] TODO: add an item for Python pygments Eric Wong
  1 sibling, 0 replies; 7+ messages in thread
From: Alyssa Ross @ 2019-09-26 15:07 UTC (permalink / raw)
  To: Konstantin Ryabitsev, Eric Wong; +Cc: meta

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]

Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:

> On Thu, Sep 26, 2019 at 01:59:53AM +0000, Eric Wong wrote:
>>I had my reservations about relying on highlight.pm; and this
>>confirms them, unfortunately :<  Oh well...
>
> I was also unable to find highlight.pm anywhere outside of Debian 
> packages.

I was, at least, able to package it for Nixpkgs relatively easily.  I
suspect other distributions might just include it with the highlight
package -- that's probably what I'll be doing.  I note that there's also
a package for it in pkgsrc.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [PATCH] hlmod: update for highlight 3.51 API change
  2019-09-26  1:59 ` Eric Wong
  2019-09-26 13:18   ` Konstantin Ryabitsev
@ 2019-09-26 15:08   ` Alyssa Ross
  1 sibling, 0 replies; 7+ messages in thread
From: Alyssa Ross @ 2019-09-26 15:08 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

Eric Wong <e@80x24.org> writes:

> I wonder if pygments or any other code highlighting packages are
> more stable.  We'd need to use a pipe or socket to interact with
> pygments or anything w/o Perl bindings.

In that case, it would also be possible to interact with highlight
without using its perl bindings -- the CLI appears to be extremely
widely packaged.

But Pygments is the one I've seen used all over the place, and I so bet
(though haven't checked) that it has better language support, etc.  So
there's probably no reason to prefer highlight if not using the Perl
bindings.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [PATCH] TODO: add an item for Python pygments
  2019-09-26 13:18   ` Konstantin Ryabitsev
  2019-09-26 15:07     ` Alyssa Ross
@ 2019-10-08 21:53     ` Eric Wong
  2019-10-08 22:00       ` Konstantin Ryabitsev
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Wong @ 2019-10-08 21:53 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: Alyssa Ross, meta, Amitai Schleier

Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> On Thu, Sep 26, 2019 at 01:59:53AM +0000, Eric Wong wrote:
> > I had my reservations about relying on highlight.pm; and this
> > confirms them, unfortunately :<  Oh well...
> 
> I was also unable to find highlight.pm anywhere outside of Debian packages.
> 
> > I wonder if pygments or any other code highlighting packages are
> > more stable.  We'd need to use a pipe or socket to interact with
> > pygments or anything w/o Perl bindings.
> 
> I'd be quite happy to be able to use pygments!

Can you write the Python glue? :>

-----------8<----------
Subject: [PATCH] TODO: add an item for Python pygments

Pygments seems to be a popular highlighter and widely available,
so we'll be providing support for that at some point...

Link: https://public-inbox.org/meta/20190926131836.GB10467@chatter.i7.local/
Link: https://public-inbox.org/meta/874l0zt7sd.fsf@alyssa.is/
---
 TODO | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/TODO b/TODO
index 93054bb3..566e0a40 100644
--- a/TODO
+++ b/TODO
@@ -115,3 +115,6 @@ all need to be considered for everything we introduce)
 
 * support searching based on `git-patch-id --stable` to improve
   bidirectional mapping of commits <=> emails
+
+* pygments support - via Python script similar to `git cat-file --batch'
+  to avoid startup penalty.  pygments.rb (Ruby) can be inspiration, too.

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

* Re: [PATCH] TODO: add an item for Python pygments
  2019-10-08 21:53     ` [PATCH] TODO: add an item for Python pygments Eric Wong
@ 2019-10-08 22:00       ` Konstantin Ryabitsev
  0 siblings, 0 replies; 7+ messages in thread
From: Konstantin Ryabitsev @ 2019-10-08 22:00 UTC (permalink / raw)
  To: Eric Wong; +Cc: Alyssa Ross, meta, Amitai Schleier

On Tue, Oct 08, 2019 at 09:53:21PM +0000, Eric Wong wrote:
> Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> > On Thu, Sep 26, 2019 at 01:59:53AM +0000, Eric Wong wrote:
> > > I had my reservations about relying on highlight.pm; and this
> > > confirms them, unfortunately :<  Oh well...
> > 
> > I was also unable to find highlight.pm anywhere outside of Debian packages.
> > 
> > > I wonder if pygments or any other code highlighting packages are
> > > more stable.  We'd need to use a pipe or socket to interact with
> > > pygments or anything w/o Perl bindings.
> > 
> > I'd be quite happy to be able to use pygments!
> 
> Can you write the Python glue? :>

I think it's pretty clear to anyone who's looked at my projects that I'm
a "sysadmin who also writes python code when he needs to" and not really
what one would call a "proper developer." :)

I mean, heck, almost none of my projects have any tests.

So, you don't really want my help. ;)

-K

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

end of thread, other threads:[~2019-10-08 22:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24 20:05 [PATCH] hlmod: update for highlight 3.51 API change Alyssa Ross
2019-09-26  1:59 ` Eric Wong
2019-09-26 13:18   ` Konstantin Ryabitsev
2019-09-26 15:07     ` Alyssa Ross
2019-10-08 21:53     ` [PATCH] TODO: add an item for Python pygments Eric Wong
2019-10-08 22:00       ` Konstantin Ryabitsev
2019-09-26 15:08   ` [PATCH] hlmod: update for highlight 3.51 API change Alyssa Ross

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.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).