Github messages for mblaze
 help / color / mirror / Atom feed
* [ISSUE] mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN
@ 2024-10-09 12:13 leahneukirchen
  2024-10-09 17:29 ` josephchoe
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: leahneukirchen @ 2024-10-09 12:13 UTC (permalink / raw)
  To: ml

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

New issue by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/266

Description:
LESSOPEN support was removed in OpenBSD in https://github.com/openbsd/src/commit/c74702f8a020c6cfd3ae0dbd2b85bf100802950e

I'm not sure how we can have something like mless without this feature... one would need to pre-render the whole sequence perhaps?

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

* Re: mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN
  2024-10-09 12:13 [ISSUE] mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN leahneukirchen
@ 2024-10-09 17:29 ` josephchoe
  2024-10-10 11:12 ` leahneukirchen
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: josephchoe @ 2024-10-09 17:29 UTC (permalink / raw)
  To: ml

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

New comment by josephchoe on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/266#issuecomment-2402900542

Comment:
That might result in performance problems for large sequences. I've just gotten around it by piping a message with the preamble into `less`, though that doesn't allow me to page through mail, but oh well.

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

* Re: mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN
  2024-10-09 12:13 [ISSUE] mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN leahneukirchen
  2024-10-09 17:29 ` josephchoe
@ 2024-10-10 11:12 ` leahneukirchen
  2024-12-19 17:11 ` josephchoe
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: leahneukirchen @ 2024-10-10 11:12 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/266#issuecomment-2404804900

Comment:
One approach could be to drive less in a loop, and use exit codes to switch between files, only starting less with one mail rendered every time.

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

* Re: mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN
  2024-10-09 12:13 [ISSUE] mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN leahneukirchen
  2024-10-09 17:29 ` josephchoe
  2024-10-10 11:12 ` leahneukirchen
@ 2024-12-19 17:11 ` josephchoe
  2024-12-22 15:07 ` leahneukirchen
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: josephchoe @ 2024-12-19 17:11 UTC (permalink / raw)
  To: ml

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

New comment by josephchoe on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/266#issuecomment-2555180271

Comment:
Hrm, I'm assuming that this would have different keybindings than `lesskey(1)`?

I looked at the source for `less(1)` on OpenBSD, and exit codes seem to be here: https://github.com/openbsd/src/blob/master/usr.bin/less/less.h#L157-L159

So, 0 for success, 1 for error, and 2 for interrupt. Not a whole lot of wiggle room to switch between specific files. Unless there's something I'm missing?

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

* Re: mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN
  2024-10-09 12:13 [ISSUE] mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN leahneukirchen
                   ` (2 preceding siblings ...)
  2024-12-19 17:11 ` josephchoe
@ 2024-12-22 15:07 ` leahneukirchen
  2024-12-22 15:07 ` leahneukirchen
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: leahneukirchen @ 2024-12-22 15:07 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/266#issuecomment-2558486427

Comment:
e.g. add `Z quit \42` to .lesskey, run lesskey, press Z in less, it exits with status 34 (=042).

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

* Re: mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN
  2024-10-09 12:13 [ISSUE] mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN leahneukirchen
                   ` (3 preceding siblings ...)
  2024-12-22 15:07 ` leahneukirchen
@ 2024-12-22 15:07 ` leahneukirchen
  2024-12-22 23:50 ` josephchoe
  2024-12-22 23:56 ` josephchoe
  6 siblings, 0 replies; 8+ messages in thread
From: leahneukirchen @ 2024-12-22 15:07 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/266#issuecomment-2558486427

Comment:
e.g. add `Z quit \42` to .lesskey, run lesskey, press Z in less, it exits with status 34 (=042).

Works on OpenBSD 7.6.

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

* Re: mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN
  2024-10-09 12:13 [ISSUE] mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN leahneukirchen
                   ` (4 preceding siblings ...)
  2024-12-22 15:07 ` leahneukirchen
@ 2024-12-22 23:50 ` josephchoe
  2024-12-22 23:56 ` josephchoe
  6 siblings, 0 replies; 8+ messages in thread
From: josephchoe @ 2024-12-22 23:50 UTC (permalink / raw)
  To: ml

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

New comment by josephchoe on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/266#issuecomment-2558662887

Comment:
Is something like this what you had in mind?
```patch
diff --git a/mless b/mless
index ddead98..48085bd 100755
--- a/mless
+++ b/mless
@@ -85,10 +85,26 @@ elif [ -f "$HOME/.mblaze/mless" ]; then
 elif [ -f "$HOME/.mless" ]; then
 	export LESSKEY="$HOME/.mless"
 fi
+[ $# -ne 0 ] && mseq -C $@
+scan=0
 while :; do
-	LESSOPEN="|$0 --filter %s" \
-		less -Ps"mless %f?m (message %i of %m).." -R \
-			"+:e $(mscan -n .)$nl" //scan $(mscan -n :)
+	local cur=$(mscan -n .)
+	local total=$(mscan -n : | tail -1)
+
+	if [ $scan -ne 0 ]; then
+		cur="//scan"
+		local status="mless.."
+	else
+		local status="mless $cur (message $cur of $total).."
+	fi
+
+	{
+		case $cur in
+			[0-9]*) $0 --filter $cur;;
+			*) $0 --filter //scan;;
+		esac
+	} | less -Ps"$status" -R
+
 	case "$?" in
 	0|1) exit $?;;
 	36) # $ goto end
@@ -111,6 +127,20 @@ while :; do
 	72) # H toggle HTML mode
 		MLESS_HTML=$((1-$MLESS_HTML))
 		;;
+	91) # [ prev file
+		case $cur in
+			1) scan=1;;
+			*) mseq -C '.-1' 2>/dev/null;;
+		esac
+		;;
+	93) # ] next file
+		if [ $scan -eq 0 ]; then
+			mseq -C '.+1' 2>/dev/null
+		else
+			scan=0
+			mseq -C 1 2>/dev/null
+		fi
+		;;
 	94) # ^ goto parent
 		mseq -C '.^' 2>/dev/null
 		;;
diff --git a/mlesskey.example b/mlesskey.example
index be82e1d..90d69af 100644
--- a/mlesskey.example
+++ b/mlesskey.example
@@ -4,8 +4,8 @@
 # When using less >=590: copy this file to ~/.mlesskey
 Q quit \1
 :cq quit \1
-[ prev-file
-] next-file
+[ quit [
+] quit ]
 { noaction E1\n
 } quit $
 $ quit $
```

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

* Re: mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN
  2024-10-09 12:13 [ISSUE] mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN leahneukirchen
                   ` (5 preceding siblings ...)
  2024-12-22 23:50 ` josephchoe
@ 2024-12-22 23:56 ` josephchoe
  6 siblings, 0 replies; 8+ messages in thread
From: josephchoe @ 2024-12-22 23:56 UTC (permalink / raw)
  To: ml

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

New comment by josephchoe on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/266#issuecomment-2558662887

Comment:
Is something like this what you had in mind?
```patch
diff --git a/mless b/mless
index ddead98..51bd361 100755
--- a/mless
+++ b/mless
@@ -85,10 +85,26 @@ elif [ -f "$HOME/.mblaze/mless" ]; then
 elif [ -f "$HOME/.mless" ]; then
 	export LESSKEY="$HOME/.mless"
 fi
+scan=0
 while :; do
-	LESSOPEN="|$0 --filter %s" \
-		less -Ps"mless %f?m (message %i of %m).." -R \
-			"+:e $(mscan -n .)$nl" //scan $(mscan -n :)
+	local cur=$(mscan -n .)
+	local total=$(mscan -n : | tail -1)
+
+	if [ $scan -ne 0 ]
+	then
+		cur="//scan"
+		local status="mless.."
+	else
+		local status="mless $cur (message $cur of $total).."
+	fi
+
+	{
+		case $cur in
+			[0-9]*) $0 --filter $cur;;
+			*) $0 --filter //scan;;
+		esac
+	} | less -Ps"$status" -R
+
 	case "$?" in
 	0|1) exit $?;;
 	36) # $ goto end
@@ -111,6 +127,21 @@ while :; do
 	72) # H toggle HTML mode
 		MLESS_HTML=$((1-$MLESS_HTML))
 		;;
+	91) # [ prev file
+		case $cur in
+			1) scan=1;;
+			*) mseq -C '.-1' 2>/dev/null;;
+		esac
+		;;
+	93) # ] next file
+		if [ $scan -eq 0 ]
+		then
+			mseq -C '.+1' 2>/dev/null
+		else
+			scan=0
+			mseq -C 1 2>/dev/null
+		fi
+		;;
 	94) # ^ goto parent
 		mseq -C '.^' 2>/dev/null
 		;;
diff --git a/mlesskey.example b/mlesskey.example
index be82e1d..90d69af 100644
--- a/mlesskey.example
+++ b/mlesskey.example
@@ -4,8 +4,8 @@
 # When using less >=590: copy this file to ~/.mlesskey
 Q quit \1
 :cq quit \1
-[ prev-file
-] next-file
+[ quit [
+] quit ]
 { noaction E1\n
 } quit $
 $ quit $

```

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

end of thread, other threads:[~2024-12-22 23:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-09 12:13 [ISSUE] mless: doesn't work on OpenBSD 7.6 due to lack of LESSOPEN leahneukirchen
2024-10-09 17:29 ` josephchoe
2024-10-10 11:12 ` leahneukirchen
2024-12-19 17:11 ` josephchoe
2024-12-22 15:07 ` leahneukirchen
2024-12-22 15:07 ` leahneukirchen
2024-12-22 23:50 ` josephchoe
2024-12-22 23:56 ` josephchoe

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 NNTP newsgroup(s).