[dev] less keys for w3m

2024-04-16 Thread Greg Reagle
This took me a long time to do.  I made any key that has a function in less 
that is also available in w3m have the same key in w3m (2nd paragraph), with a 
few exceptions, that are in my 1st paragraph.  I am posting this here for 
feedback, suggestions, improvements, etc.  And in case anyone wants to try it.  
I did not do anything with Meta/Alt keys because some of them clash with my dwm 
keys.

I am fairly confident in my 1st through 3rd and 5th paragraphs.  I am not so 
confident in my 4th paragraph (w3m features not in less).  I tried to make it 
somewhat mnemonic and to keep similar functions on similar keys.  For example:
  x and X are NEXT and PREV
  t and T and C-t all deal with tabs
  p & P and o & O have similar functionality

Here it is following:

# w3m defaults incompatible with less, but fundamental to w3m and very 
convenient
keymap  C-j GOTO_LINK
keymap  h   MOVE_LEFT
keymap  j   MOVE_DOWN
keymap  k   MOVE_UP
keymap  l   MOVE_RIGHT

# w3m defaults not compatible with less
# ASCII hyphen-dash
keymap  -   SET_OPTION
keymap  <   BEGIN
keymap  >   END
keymap  C-b PREV_PAGE
keymap  C-e UP
keymap  C-f NEXT_PAGE
keymap  C-k DOWN
keymap  C-m UP
keymap  C-n UP
keymap  C-p DOWN
keymap  C-r REDRAW
keymap  C-y DOWN
keymap  DOWNUP
keymap  e   UP
keymap  E   LOAD
keymap  f   NEXT_PAGE
keymap  LEFTSHIFT_LEFT
keymap  m   MARK
keymap  r   REDRAW
keymap  RIGHT   SHIFT_RIGHT
keymap  s   SAVE_SCREEN
keymap  UP  DOWN
keymap  v   EDIT
keymap  V   VERSION
keymap  w   PREV_PAGE
keymap  y   DOWN
keymap  Y   DOWN
keymap  z   NEXT_PAGE
keymap  \'  NEXT_MARK
# underscore
keymap  _   OPTIONS

# w3m defaults already compatible with less
keymap  !   SHELL
keymap  /   SEARCH
keymap  =   INFO
keymap  ?   SEARCH_BACK
keymap  b   PREV_PAGE
keymap  C-g LINE_INFO
keymap  C-l REDRAW
keymap  C-s ISEARCH
keymap  C-t TAB_LINK
keymap  C-v NEXT_PAGE
keymap  C-z SUSPEND
keymap  g   BEGIN
keymap  G   END
keymap  H   HELP
keymap  J   UP
keymap  K   DOWN
keymap  n   SEARCH_NEXT
keymap  N   SEARCH_PREV
keymap  Q   EXIT
keymap  q   QUIT
keymap  R   RELOAD
keymap  SPC NEXT_PAGE
keymap  |   PIPE_BUF
#   Home key
keymap  M-[1~   BEGIN
#   Insert key
keymap  M-[2~   MENU
#   End key
keymap  M-[4~   END
#   Page Up key
keymap  M-[5~   PREV_PAGE
#   Page Down key
keymap  M-[6~   NEXT_PAGE
#   F10 function key
keymap  M-[21~  MENU

# w3m features not in less
keymap  ,   TAB_LEFT
keymap  .   TAB_RIGHT
keymap  a   SAVE_LINK
keymap  A   ADD_BOOKMARK
keymap  B   BACK
keymap  C   COMMAND
keymap  C-d BOOKMARK
keymap  C-o COOKIE
keymap  C-t TAB_LINK
keymap  C-u GOTO_RELATIVE
keymap  C-x ISEARCH_BACK
keymap  C-] TAB_MENU
keymap  d   NEXT_WORD
keymap  o   LIST_MENU
keymap  O   MOVE_LIST_MENU
keymap  p   SELECT
keymap  P   SELECT_MENU 
keymap  t   TAB_GOTO
keymap  T   NEW_TAB
keymap  U   GOTO
keymap  x   NEXT
keymap  X   PREV
keymap  \"  MOUSE_TOGGLE
keymap  \\  VIEW
keymap  {   PREV_TAB
keymap  }   NEXT_TAB
keymap  ~   LINK_MENU
#   F10 function key
keymap  M-[21~  MENU

# extra keys
keymap  ^?  PREV_PAGE



Re: [dev] reading an epub book with less: adventures in text processing

2024-03-11 Thread Greg Reagle
On Sat, Mar 9, 2024, at 1:15 PM, Greg Minshall wrote:
> for some personal tastes/usage cases, this, using pandoc's `-t`
> option, might be minor-ly simpler:
> 
> man --local-file --pager 'less -ir' \
> <(pandoc --standalone -t man \
> 2015.31233.Arab-Geographers-Knowledge-Of-Southern-India.epub) | less
> 

Very cool command.  Good idea to use process substitution.  Here is another way 
of doing it:
pandoc --standalone -t man City_of_Truth-Morrow.epub | man /dev/stdin
but I don't know how portable /dev/stdin is.



[dev] Re: reading an epub book with less: adventures in text processing

2024-03-11 Thread Greg Reagle
I think I finally figured it out!  With help, of course, from my wise and 
helpful community.  Thanks!  And reading the man page for elinks. :>

for direct viewing in less:
pandoc -s -t html City_of_Truth-Morrow.epub | elinks -dump-color-mode 2 
-force-html | less -ir

to make a file to keep, for repeated viewing in less:
pandoc -s -t html City_of_Truth-Morrow.epub | elinks -dump-color-mode 2 
-force-html > City_of_Truth-Morrow-formatted.txt

Now my next question is, what is the tool that does the *best* job of turning a 
PDF book into a readable text document?  Via html or docbook or markdown or 
whatever--doesn't matter.  My previous experience trying things out to achieve 
this goal is that it's just not worth it.  The output always winds up 
un-readable.



Re: [dev] Re: reading an epub book with less: adventures in text processing

2024-03-11 Thread Greg Reagle
On Sat, Mar 9, 2024, at 12:53 PM, LM wrote:
> You could try modifying sdlbook or bard.  It would be nice if either of these 
> offered keymapping functionality like some programming editors do.

Thank you for telling me about these two programs.  I had not heard of them.

https://github.com/rofl0r/SDLBook
https://github.com/festvox/bard



Re: [dev] reading an epub book with less: adventures in text processing

2024-03-11 Thread Greg Reagle
On Sat, Mar 9, 2024, at 4:06 PM, Georg Lehner wrote:
> Option 1: use w3m
[snip]

All great commands.  Thank you.

> The reason you loose formatting when saving from less(1) or w3m is, that 
> these programs on purpose do not save the terminal control characters 
> which are doing the markup. Line breaks and terminal control are created 
> on demand, depending on the type and size of the terminal (window) and 
> will display different (weird) when any of this is different from the 
> terminal you (would have) saved them to a file.

Yes I have noticed this.  I would like to be able to tell programs to keep the 
formatting, but they decide automatically on their own to remove it.  The 
automatic decision to keep or remove formatting based on terminal type is fine, 
but I find it very annoying that I cannot override this decision with many 
programs.  GNU's ls is an exception (with the --color option).  I would like to 
tell w3m or elinks to dump html and keep the formatting, which they cannot do 
(directly).  There are ways around that cause extra steps.

> The -s option (--standalone) option for Pandoc is not required for man 
> page output.

Well it definitely is for me, meaning the version of Pandoc that I use: 
2.17.1.1-2~deb12u1 amd64



Re: [dev] reading an epub book with less: adventures in text processing

2024-03-11 Thread Greg Reagle
On Sat, Mar 9, 2024, at 11:33 AM, Hiltjo Posthuma wrote:
> Maybe mupdf/mutools or the eGhostscript tools o qpdf?

Yes, thank you for this excellent advice.  I tried "mutool convert", but I am 
more satisfied with pandoc's output, for both text and html output (from epub).



[dev] Re: reading an epub book with less: adventures in text processing

2024-03-09 Thread Greg Reagle
On Sat, Mar 9, 2024, at 9:34 AM, Greg Reagle wrote:
> I want to read it, with formatting (such as underline or italics), with 
> less.

Or, I would be satisfied with an ebook reader program (either TUI or GUI is 
fine) that has the same functionality and keys as less.  Of course it can have 
some extra functionality and keys that would be useful specifically for reading 
or annotating an ebook, just not conflicting with less behavior.

I like the idea of a program that is backwards-compatible with less, in terms 
of functionality and keys.  Maybe I will see if I can make a less-compatible 
branch for something like mupdf.



[dev] reading an epub book with less: adventures in text processing

2024-03-09 Thread Greg Reagle
I have an epub ebook.  It is a novel, but when I get this process working, I 
want to repeat it for any epub ebook.

I want to read it, with formatting (such as underline or italics), with less.  
I am happy to use any software that exists in the process, but I MUST use less 
in the end to read it.  The terminal emulators that I use are usually st, 
xterm, and termux.  All of them are capable of colored text and underlining and 
so forth, and I want to take advantage of this.

Pandoc does a very good job converting epub to html, and it looks good with 
w3m, however when I use w3m in a pipe, the output is truly *plain* text, 
meaning there are no escape codes for formatting.  Same story with elinks.  Is 
it possible to get either of these programs, or some other program, to dump 
html to text *with* escape codes?

Since I could not get HTML to work, I went with man format.  Amazing.  Pandoc 
automatically chooses man format for output based on the '.1' extension in the 
followingv
pandoc --standalone -o City_of_Truth-Morrow.1 City_of_Truth-Morrow.epub
Remember to use standalone option or it won't work.  Then
man --local-file --pager 'less -ir' City_of_Truth-Morrow.1
It looks great!  (for text only on a terminal)  It has bold and underlined 
text.  From there I can use less 's' command to save the formatted text to a 
file.

There might be a better or more direct way of achieving this goal, but this I 
what I figured out for now.  And the rationale is this:  I already know and 
love less.  There is no good reason for me to learn the user interface of a 
different program like an epub reader or an html reader to read a book that 
does not have graphics, diagrams, pictures, and/or custom formatting.



[dev] Re: dwm: Maybe a combination of columns and grids?

2024-03-09 Thread Greg Reagle
On Thu, Jan 25, 2024, at 2:48 PM, Greg Reagle wrote:
> I love the way that the columns patch handles the master area, i.e. the 
> ability to control its width and number of windows, and that the 
> windows in the master area take up the full height of the display.  In 
> the stacking area, though, I'd love for those windows to be managed 
> like a (gapless) grid.  In this context gapless does not mean a few 
> pixels, but a big chunk missing.

FYI, I found the centeredmaster [1] patch and I am very happy with it.  It does 
not do exactly what I asked for (quoted above), but it still is very satisfying.

[1] https://dwm.suckless.org/patches/centeredmaster/



Re: [dev] dwm: Maybe a combination of columns and grids?

2024-01-26 Thread Greg Reagle
On Thu, Jan 25, 2024, at 8:16 PM, lain. wrote:
> On 2024年01月25日 14:48, the silly Greg Reagle claimed to have said:
>> Salutations.  Is there already a dwm layout patch for what I describe below?
>> 
>> I love the way that the columns patch handles the master area, i.e. the 
>> ability to control its width and number of windows, and that the windows in 
>> the master area take up the full height of the display.  In the stacking 
>> area, though, I'd love for those windows to be managed like a (gapless) 
>> grid.  In this context gapless does not mean a few pixels, but a big chunk 
>> missing.
>> 
>> Does it already exist?  Thanks!
>
> Yes, this sounds like the default behavior of DWM.

The default behavior of dwm is to stack the stacking area, not to manage it as 
a grid.



[dev] dwm: Maybe a combination of columns and grids?

2024-01-25 Thread Greg Reagle
Salutations.  Is there already a dwm layout patch for what I describe below?

I love the way that the columns patch handles the master area, i.e. the ability 
to control its width and number of windows, and that the windows in the master 
area take up the full height of the display.  In the stacking area, though, I'd 
love for those windows to be managed like a (gapless) grid.  In this context 
gapless does not mean a few pixels, but a big chunk missing.

Does it already exist?  Thanks!



[dev] I didn't know that you could use the shell like this: compound pipe?

2024-01-15 Thread Greg Reagle
I didn't know that you could use the shell like this.  What a delightful 
surprise.  Here is the code for bash/dash:

command | (read -r; printf "%s\n" "$REPLY"; sort)

The purpose of this is to keep the header and not sort it, but sort the rest.  
It is for a command that produces a header when you want to keep the header.  
From 
https://unix.stackexchange.com/questions/11856/sort-but-keep-header-line-at-the-top

Inspired by this, I came up with this for my favorite shell, rc (of Plan9Port):

ps aux | {printf '%s' `{read -n 1}; sort -k4 -n} | awk '$4>=0.5 || $0~"USER"' | 
less -S

This shows processes sorted by column 4 which is percent of memory.  The awk 
command excludes processes using less than one half of a percent of memory and 
includes the header line.  This is running on Debian fyi.  I think that the 
read command is from Plan9Port, and all the rest of the commands are the Debian 
standards, i.e. belonging to either Linux or GNU.  Here is a simpler version 
that shows all processes:

ps aux | {printf '%s' `{read -n 1}; sort -k4 -n} | less -S




[dev] what is a suckless way to add a few keyboard shortcuts to Firefox

2024-01-04 Thread Greg Reagle
Greetings fellow software minimalists.  I know that Firefox is quite large, but 
I really like it.  I've been using it forever (figuratively speaking).  I would 
really love to add a few keyboard shortcuts to make it compatible with one of 
my beloved programs: less(1).  Of course the keys for less and vi are similar.

I know about extensions for Firefox and even entire browsers that try to give a 
vi-like UI.  However, they are way too much for me.  They disrupt my workflow 
by changing Firefox too much.  They overdo it.  I don't want to do anything but 
*add* a few keyboard shortcuts.  What is the least sucky way to do so?  Here a 
few example keys.  Note that they are for viewing/scrolling, not when 
typing/entering text:

New key Current key
--- ---
g   Home
G   End
f   Page Down
b   Page Up
n   Ctrl-g
N   reverse direction Ctrl-g



Re: [dev] [abduco] Sending stdin or string to a session from script?

2024-01-02 Thread Greg Reagle
On Fri, Dec 29, 2023, at 4:08 AM, Unicorn wrote:
> I am wondering whether it's possible to send a string or the contents of 
> stdin to a session in abduco to be able to interact with a session from a 
> script, similar to dtach -p. A search of the manpage, readme and list 
> archive didn't turn up anything relevant.

I am looking at the man page now at 
https://github.com/martanne/abduco/blob/master/abduco.1 and I see that it does 
have a -p option described as "Pass through content of standard input to the 
session."  I am guessing that you are using an older version.  It looks like 
this feature was added on Mar 17, 2018, see
https://github.com/martanne/abduco/commit/fd34b98db77accb3a43f220a0639cba8132834c3



Re: [dev] [st] terminfo entries won't get deleted

2023-02-03 Thread Greg Reagle
On Fri, Feb 3, 2023, at 7:50 AM, Hiltjo Posthuma wrote:
> On Thu, Feb 02, 2023 at 10:33:55PM +, danin-sac wrote:
>> after looking in the Makefile I saw that the terminfo entries wouldn't get 
>> deleted if you uninstall the program. Is there a specific reason for that?
>
> maybe

Classic Hiltjo!



Re: [dev] a terminal transformer, analogous to a unix filter

2023-01-22 Thread Greg Reagle
On Sat, Jan 21, 2023, at 10:29 AM, Rodrigo Martins wrote:
> This has great potential. It can simplify the terminal program while 
> being very unixy.
>
> Here are some ideas for filters/transformers:
>
> - Unicode input: like composition key in the linux terminal or Xorg.
> - Lock: asks for password when locked, behaves like cat otherwise.
> - Macro: allows recording and replaying key sequences.
> - Keybinding: allows configuring key sequences to launch programs.
> - Color remover: doesn't forward escape sequences that change color.
> - Clipboard: allows copying and pasting.
> - Status bar: takes over a line of the terminal, showing system status.

Yes, exactly, if it can work.  I ask myself:  if it were possible to compose 
(pipeline), wouldn't someone have thought of it already, and done it already?

For the Unicode input example, I know there are other, probably easier and 
better ways to include exotic characters, but it is a good example to think of 
as a terminal transformer.  I could write a very simple and small filter (stdin 
to stdout) that replaces 0x (where each question mark is a hex digit) with 
its utf-8-encoded code-point.  It could be attached to the input stream and/or 
the output stream.  Such a filter would be very easy to write, but quite 
useful, if it could be hooked up to a terminal emulator.  Of course I would 
have to think of some way to escape the 0x, i.e. send it through literally. 
 And it would work on top of *any* terminal emulator.

What is holding me back right now is just getting the skeleton of a terminal 
transformer written.  It would provide a pty/tty and communicate with another 
pty/tty (e.g. st or xterm).  The skeleton program would just pass every byte 
through in both directions.  Can anyone think of how to write this?  Give some 
advice?



[dev] st: no need for scrollback patch or program by using -o option

2023-01-08 Thread Greg Reagle
I wrote this little wrapper script I call ost:

<<<
#!/bin/sh
export ST_LOG_FILE=$(mktemp) || { printf '%s\n' "$0: cannot create temp file" 
>&2 ; exit 1; }
st -o "$ST_LOG_FILE" "$@"
rm "$ST_LOG_FILE"
>>>

If some output scrolls past that I want to go back and see, I look at its 
"$ST_LOG_FILE" in another terminal.  This seems to obviate my need for a 
scrollback patch or program.



[dev] a terminal transformer, analogous to a unix filter

2023-01-07 Thread Greg Reagle
I have coined the phrase terminal transformer for a class of programs
like tmux, dvtm, tcvt, and splitvt.  Perhaps there is already a phrase.
A terminal transformer runs on top of a terminal emulator and acts as
a terminal emulator itself, with an application like nano running on
top of it.  In other words, it uses a terminal emulator and is used
as a terminal emulator.

I would like to experiment with a completely transparent transformer as
a starting point.  A transparent transformer passes through everything.
Ideally it does nothing.  Just as a--not useful--example, if I want
hitting the left cursor key to move the cursor left then right then left
again, I can add code to intercept that escape sequence and program it
to do that.  That is how I imagine experimenting with more sophisticated
and useful transformations.

I would like some guidance on developing a program that is a transparent
terminal transformer in a way that is as simple and stupid as possible.
Do you have any idea how short or long it would be?  What I could look at
as an example?  I am thinking that in order to make it a simple and stupid
as possible, it runs on top of st and masquerades as st.  It uses no
library like curses or libvte.  It deals directly with escape sequences.
Is such a thing possible or practical?  It would be analogous to using
cat as a filter, and would be as simple as sbase's cat.c (as an ideal, I
know it does a lot more than cat).

If or when I come up with a useful transformation, I might want to
make it terminal independent by using curses or libvte, but that is for
the future.

Can anyone help?



Re: [dev] [surf] Ctrl-Y doesn't copy url to clipboard

2022-08-03 Thread Greg Reagle
On Wed, Aug 3, 2022, at 8:43 AM, Chris Weber wrote:
> When I start a blank installation of surf and try to copy any url into
> my clipboard via ctrl-y (as stated in the man pages), it won't copy
> anything at all. Is the man page outdated? Am I doing anything wrong? Do
> I need to install some userscripts for this?

"Ctrl-y Copies current URI to primary selection." according to my man page.

Are you using X11?  If yes, I highly recommend that you learn the difference 
between "PRIMARY and "CLIPBOARD" selections [1], and learn how to use PRIMARY.  
Being able to copy and paste with the mouse without the keyboard is one of the 
joys of my using Linux rather than MS Windows.  I don't use Wayland and don't 
know how it works.

[1] https://freedesktop.org/wiki/Specifications/ClipboardsWiki/



Re: [dev] show line number *and* column number in a search

2022-06-20 Thread Greg Reagle
On Mon, Jun 20, 2022, at 3:00 AM, m...@datameer.com wrote:
> "Greg Reagle"  wrote:
>> ls | awk '/er.*/ {match($0, /er.*/); print $0; print 
>> NR":"RSTART"-"RSTART+RLENGTH}'
>> debfoster-a-notes.txt
>> 3:8-22
>> vdirsyncer
>> 21:9-11
>> 
>> So there is a match on line 3 columns 8-22 and line 21 columns 9-11.  
>> Exactly what I want.  I am curious though, is there a "better" way?  A 
>> version of grep that has a column number option?  Are just a simpler way of 
>> achieving this goal?
>
> I'm using ag[0]. Does that fit your needs?
>
> [0] https://geoff.greer.fm/ag/

I tried the related program ack because it was easy for me to install (I don't 
see a Debian stable package for ag), and it does produce a starting column 
number.  Thank you for the suggestion!

ls | ack -H --column 'er.*'
-
3:8:debfoster-a-notes.txt
20:9:vdirsyncer



[dev] redirecting standard error to another terminal

2022-06-18 Thread Greg Reagle
OMG I wish I had known this YEARS ago.  I can redirect the standard error of a 
program to a different terminal!  I am using X11 and dwm and st on Debian.  For 
example:

ls --foobar 2> /dev/pts/0

I am excited by the possibilities and mad at myself for not having thought of 
doing this before.

When I am debugging a terminal program that use the whole screen (like a text 
editor running ncurses) it doesn't really work to have stderr information mixed 
in with the TUI.  Problem solved!  I can print debugging information to stderr. 
 Or it would help with debugging something like dvtm.

Now that I think about it, redirecting stderr to a log file and looking at the 
log file with tail -f in another terminal would also achieve similar goal, I 
guess.



[dev] show line number *and* column number in a search

2022-06-18 Thread Greg Reagle
Greetings.  The compiler I've been using recently very helpfully provides the 
line number *and* column number in warnings and error messages.  I would like 
to be able to search a file and see both numbers.  Note that I am not 
interested in doing this within any particular editor--I imagine it is possible 
and done differently for every editor family.  I want a standalone solution 
independent of editor.

Grep has a line number option but not column number option.  I spent a while 
searching the WWW to no avail, but I have come up with an awk solution.

ls | awk '/er.*/ {match($0, /er.*/); print $0; print 
NR":"RSTART"-"RSTART+RLENGTH}'
debfoster-a-notes.txt
3:8-22
vdirsyncer
21:9-11

So there is a match on line 3 columns 8-22 and line 21 columns 9-11.  Exactly 
what I want.  I am curious though, is there a "better" way?  A version of grep 
that has a column number option?  Are just a simpler way of achieving this goal?



[dev] ii: how to process out in a pipeline and still page with less

2022-05-27 Thread Greg Reagle
I have a file named "out" (from ii) that I want to view.  Of course, it can 
grow while I am viewing it.  I can view it with "tail -f out" or "less +F out", 
both of which work.  I also want to apply some processing in a pipeline, 
something like "tail -f out | tr a A | less" but that does not work.  The less 
command ignores my keystrokes (unless I hit Ctrl-C, but that kills tail and 
tr).  The "tr a A" command is arbitrary; you can substitute whatever processing 
you want, even just cat.

This command "tail -f out | tr a A" is functional and has no bugs, but it 
doesn't let me use the power of less, which I crave.

This command "tail out | tr a A | less" is functional and has no bugs, but it 
doesn't let me see newly appended lines.

Can I use the power of the Unix pipeline to do text processing and the power of 
less for excellent paging and still be able to see new lines as they are 
appended?  Why doesn't or can't less continue to monitor stdin from the 
pipeline and respond to my keystrokes from the tty?

I am using Debian 11 in case it matters, with fish.  But I am happy to try 
other shells.  In fact I already have and that doesn't seem to help.  I have 
also tried more, most, nano -, and vi -, instead of less, to no avail.



Re: [dev] sam/vis command language: how to go to line and column

2022-04-04 Thread Greg Reagle
On Mon, Apr 4, 2022, at 7:26 PM, Greg Reagle wrote:
> How do I go to line and column in sam/vis command language?  This 
> command works: 
>   10-/$/+/^/+#5
> but there has got to be a better way, right?

To maybe answer my own question, this works:
  10-+5
but am I missing something?  Is there a more direct way?



[dev] sam/vis command language: how to go to line and column

2022-04-04 Thread Greg Reagle
Hello all you sam and vis users.  I am learning sam.  I want to do something 
like go to column 5 of line 10 of the current file in sam.

The command 10#5 goes to column 5 of line 11.  This is because the 10 command 
selects ALL of line 10 (it doesn't just put the cursor at the beginning of line 
10) then the #5 command goes 5 characters forward from the end of the selection 
(i.e. the end of line 10).

How do I go to line and column in sam/vis command language?  This command 
works: 
  10-/$/+/^/+#5
but there has got to be a better way, right?



Re: [dev] dwm oddity

2022-04-04 Thread Greg Reagle
I have not experienced this.

On Sun, Apr 3, 2022, at 6:10 PM, Greg Minshall wrote:
> hi.  i'm using dwm v6.2 under Arch linux.  my own source build.  i'm
> using the "taggrid" patch.  my laptop has a touch pad.
>
> when i am in monocle mode (which i mostly am), every now and then when i
> type a key, i end up in a situation where the application hasn't changed
> (i.e., is what is showing on the screen), but the keyboard focus (and
> the "title" on the bar, next to the tags) changes to one of the
> non-visible apps.  likely, the heel of my palm is making some (light?)
> contact with the touch pad.
>
> i'm wondering if anyone has seen this, or has any thoughts?
>
> cheers, Greg



Re: [dev] ssam rocks! unwrapping paragraphs

2022-03-22 Thread Greg Reagle
On Tue, Mar 22, 2022, at 9:49 PM, 201009-suckl...@planhack.com wrote:
> sed is the canonical paragraph mangler. It's worth spending a bit to 
> grok how that is true.
>
> tr -d '\r' | sed '/^$/!{H;d;};p;x;s/\n/ /g;'
>
> Gutenberg lines are CRLF-terminated so `tr` is needed.

Right I forgot to mention that I had to 
  tr -d '\r'
first.  Thanks for mentioning that.

Close, but no cigar.  That sed command introduces extra blank lines.  It is 
incorrect.  ssam reigns supreme!

  tr -d '\r' < 2488-0.txt | ssam -e 'x/\n+/ v/\n\n+/ c/ /' | wc -l
7667
  tr -d '\r' < 2488-0.txt | sed '/^$/!{H;d;};p;x;s/\n/ /g;' | wc -l
7782



[dev] ssam rocks! unwrapping paragraphs

2022-03-22 Thread Greg Reagle
Hello.  I downloaded a text file from Project Gutenberg and the paragraphs were 
hard wrapped, aka filled in Emacs jargon.  I want the lines to wrap to whatever 
window width I am using of course, so I want them to be un-wrapped in the text 
file.  I tried all sorts of sed/awk/grep/perl ways to unwrap the paragraphs 
(that were complicated), but nothing worked well.  Then I did:

ssam -e 'x/\n+/ v/\n\n+/ c/ /'

Bingo!  So elegant, so effective.  Would you consider adding ssam to 9base?  It 
is a simple script in the Plan9Port project.

I challenge you, if you are interested, to come up with another way of 
unwrapping the paragraphs that sucks less than the ssam command above.



Re: [dev] ST 'loginShell'

2022-03-03 Thread Greg Reagle
Both bash and fish have a dash ell -l option or --login.  I don't know about 
OpenBSD ksh, read the man page.



Re: [dev] Is there a text editor following the UNIX philosophy?

2022-02-11 Thread Greg Reagle
Are you aware of sam, acme, and vis?

https://github.com/martanne/vis



Re: [dev] conference video mirror

2022-01-16 Thread Greg Reagle
If it's slow, download then watch.

Also, I just tried 
https://dl.suckless.org/slcon/2019/slcon-2019-00-laslo_hunhold-openbsd_supremacy.webm
 and it was fine.  It buffered much quicker than I watched it.

On Sat, Jan 15, 2022, at 2:47 AM, NRK wrote:
> Hi,
>
> I've noticed that the videos hosted at https://suckless.org/conferences
> are basically unwatchable due to unreasonably low speed (I get around
> 30~50/kbps).
>
> Are there any mirrors available? If not, then are there plans on
> mirroring them somewhere (maybe peertube or library/odysee) ?
>
> - NRK



Re: [dev] surf: copy and paste

2021-10-18 Thread Greg Reagle
On Mon, Oct 18, 2021, at 2:36 PM, Alex Beakes wrote:
> Wanted to ask if there is any way to copy and paste text in surf like in 
> any other browser, using the usual ctrl+c/v keybindings.
> Trying to use surf as my main driver.need the copy/paste function.

FYI, I am using Debian Stable 11 and X11 (dwm).  I just cloned surf and built 
and ran it (I did not use the Debian package which is older), and here is the 
behavior that I get:  Paste can be achieved by Control-v and/or Shift-Insert.  
Copy can be achieve by Control-Insert.

Since these keys are not specified in config.def.h of surf, I assume that they 
come along with a library on which surf depends.

Note that these operations use the CLIPBOARD selection, which is what I expect 
[1].  It is also possible to use the PRIMARY selection in X11, as explained in 
[1].

[1] https://freedesktop.org/wiki/Specifications/ClipboardsWiki/



Re: [dev] tcvt: very useful for seeing more at once

2021-10-15 Thread Greg Reagle
On Thu, Oct 14, 2021, at 9:56 PM, Rudy Dellomas (dther) wrote:
> `tcvt` is a python terminal multiplexer, which is a bit excessive for the
> purpose of saving terminal columns. Even forgoing that GNU man has
> $MANWIDTH, why not just use vertical split tmux? It's faster (written in
> C) and is much more versatile. This would do more or less the same:
>
> `tmux new ';' splitw -h man dwm`

No, this does not do what tcvt does.  Have you actually tried it?  Nor does the 
MANWIDTH variable.



Re: [dev] tcvt: very useful for seeing more at once

2021-10-14 Thread Greg Reagle
On Thu, Oct 14, 2021, at 7:20 PM, Martin Tournoij wrote:
> I wonder if there's a way to do the same with tmux 樂

I had the same question.  Let me/us know if you find out.

> Also suspect you can get pretty close with far less code and curses 
> shizzle. I'll have to try some stuff later.

Again, let me/us know.  I see no alternative to tcvt for the same 
functionality.  Vim and Emacs can do it, but only within vim and emacs.



Re: [dev] tcvt: very useful for seeing more at once

2021-10-14 Thread Greg Reagle
On Thu, Oct 14, 2021, at 2:24 PM, Markus Wichmann wrote:
> You know, if you were trying to shill the program, you might have done
> better if you had provided the homepage. I searched for "tcvt", and all

Shill--I wish.  I get no money from people using it. Just trying to be helpful.
  http://subdivi.de/~helmut/tcvt/



[dev] tcvt: very useful for seeing more at once

2021-10-14 Thread Greg Reagle
FYI

Useful, but a lot of wasted screen space on my monitor:
man dwm

MUCH better!  I see the entire man page:
tcvt -c 4 man dwm



Re: [dev] Suckless regex

2021-08-11 Thread Greg Reagle
On Tue, Aug 10, 2021, at 07:21, Kyryl Melekhin wrote:
> https://github.com/kyx0r/pikevm
> Suckless regex implementation, please consider.

Kyryl Melekhin, you might already be familiar with this web page, but for those 
who are not, I find this web page informative:  
https://swtch.com/~rsc/regexp/  This page collects resources about implementing 
regular expression search efficiently

The link to "Plan 9 grep" doesn't work, so try 
https://tools.suckless.org/9base/ or https://9fans.github.io/plan9port/



Re: [dev] Why not use the -exec feature of find?

2021-06-22 Thread Greg Reagle
On Tue, Jun 22, 2021, at 09:59, Sean MacLennan wrote:
> The -exec flag spawns a new process for every file match.

Even when you use multiple arguments per command as with
-exec '{}' +
?  It is still spawning a new process for every file match?

> This can be
> slow if you have a lot of files.

That makes sense.

> From the command line I use -exec all the time and just don't worry
> about it.

Thank you!



[dev] Why not use the -exec feature of find?

2021-06-22 Thread Greg Reagle
All over the place (tutorials, manuals, articles, questions and answers) I see 
the advice to use the null feature of find (-print0) and xargs (-0) to be able 
to handle any kind of wacky file name (e.g. filenames with newlines).  Granted, 
*if* you are going to pipe find into xargs, the advice makes sense.  But 
wouldn't it be better in every way to use the -exec (or -execdir) feature of 
find instead of piping into xargs?  Why isn't that the common advice?  Is the 
-exec feature of find fairly new, or fairly new to Posix?



[dev] another ssam?

2021-05-26 Thread Greg Reagle
I started trying pkgsrc today (I use Debian Stable).  It's interesting.  I 
don't know if it "sucks".  It seems to be fairly sophisticated/elaborate, so 
maybe it is "heavy" rather than light.  Anyway . . .

I found ssam in the editors directory [1] which seems to be maintained by 
Alistair G. Crooks.  It looks like it was actually written by Alistair G. 
Crooks based on the copyright notice in the source files.  I am guessing that 
it is a completely independent (reverse-engineered?) implementation of 
Structural Regular Expressions.  Can anyone confirm or deny this?  Has anyone 
tried it, or know how compatible it is with Plan9 sam/ssam?  Plan9Port has an 
ssam too which is just a script to use sam.

[1]  https://pkgsrc.se/editors/ssam



[dev] adding mtm to the suckless website

2021-05-21 Thread Greg Reagle
I would like to add mtm (https://github.com/deadpixi/mtm), but I don't know 
whether to add it to "rocks" or "other_projects".  What is the difference?



[dev] trying to debug dvtm: fuzz testing?

2021-05-20 Thread Greg Reagle
I have used dvtm in the past but gave up because of crashes that were 
unpredictable.  I know C and I have recently learned a bit more about gdb and 
core dumps and debugging, so I think that I might be able to be more helpful in 
debugging.  I doubt that I'll be able to write a patch to fix a problem, but I 
might be able to pinpoint a problem to a specific line and function and 
variable(s).

So my first question:  Is there any consistently reproducible bug in dvtm?  I 
use Debian stable (I can use the latest git version of dvtm of course).  My 
other question:  Would it be possible or a good idea to use the fuzz program to 
fuzz test it?  Would there be a better way to fuzz test it?



[dev] I made Emacs use the same keys as st for changing font size

2021-05-12 Thread Greg Reagle
Perhaps I am the only suckless fan who also uses Emacs. :>

Here is how I made Emacs use the same keys as st for changing font size:
(global-set-key (kbd "C-S-") 'text-scale-increase)
(global-set-key (kbd "C-S-") 'text-scale-decrease)
(global-set-key (kbd "C-S-") 'text-scale-set)



Re: [dev] less lines of code suck less

2021-05-03 Thread Greg Reagle
> Would sbase suck less if the program head, which is currently a C 
> program of 77 lines, were replaced with something like 
>   #!/bin/sh
>   sed "$1"q

Here it is in 37 lines of glorious rc shell code.  Note that head.c also 
depends on several functions in libutil, so it is more than 77 lines really.

#!/usr/bin/env rc

fn usage {printf '%s [-n num] [file ...]\n' $0; exit $1}
fn numeric {printf '%s' $1 | grep -Eq '^[0-9]+$'}
fn positive {expr $1 '>' 0 > /dev/null}
lines=10
while (! ~ $#* 0 && ~ $1 -* && ! ~ $1 --) {
switch($1) {
case -n
if (~ $2 ?*) {
if (numeric $2 && positive $2) {
lines=$2
shift
}; if not {   # else
usage 1
}
}; if not {
usage 2
}
case -*;  usage 3
}
shift
}
if (~ $1 --) {shift}
switch($#*) {
case 0
echo sed $lines^q
case 1
echo sed $lines^q $1
case *
while (! ~ $#* 0) {
printf '==> %s <==\n' $1
echo sed $lines^q $1
shift
}
}
true  # otherwise script will exit with error


head.rc
Description: application/vnd.kde.kxmlguirc


Re: [dev] less lines of code suck less

2021-05-03 Thread Greg Reagle
On Mon, May 3, 2021, at 16:51, Jeremy wrote:
> I'd argue that requiring awk to use `head` would create more
> complexity(for the end user) than it would solve for the developer.

I assume that you mean requiring head to use awk.  I cannot imagine how it 
would have any effect at all on the end user.  And if it has less lines, in a 
higher level language, sounds like a win.



[dev] Re: less lines of code suck less

2021-05-03 Thread Greg Reagle
I'm sorry I forgot to include this in my initial message.  I found no 
difference in performance time or memory usage (with a small file), so that 
does not seem to be an advantage.

And I am serious about this--I really want to know.  Is there any good reason 
to have a separate C program?

On Mon, May 3, 2021, at 16:28, Greg Reagle wrote:
> Would sbase suck less if the program head, which is currently a C 
> program of 77 lines, were replaced with something like 
>   #!/bin/sh
>   sed "$1"q
> 
> I know that it would need to be a bit more elaborate than that to 
> handle the -n flag, but still.  Is there any advantage to having a 
> separate C program?
> 



[dev] less lines of code suck less

2021-05-03 Thread Greg Reagle
Would sbase suck less if the program head, which is currently a C program of 77 
lines, were replaced with something like 
  #!/bin/sh
  sed "$1"q

I know that it would need to be a bit more elaborate than that to handle the -n 
flag, but still.  Is there any advantage to having a separate C program?



Re: [dev] Ada not Rust

2021-05-02 Thread Greg Reagle
On Sun, May 2, 2021, at 09:22, Laslo Hunhold wrote:
> "Greg Reagle"  wrote:
> > Thank you for your explanation Laslo Hunhold.  I wholeheartedly agree
> > with you about the fallibility of human programmers, and the
> > vulnerability of C to errors.  Even though I am a fan of the suckless
> > philosophy and its programs, which are written in C, I wish that a
> > less error-prone language would be used.
> 
> you summarized that very well. I completely agree.

Do you have any other suggestions for alternatives to C?

> > Perhaps I will write (or more likely re-write a C program) a very
> > small program in Ada as a proof-of-concept of the viability of Ada
> > for several purposes:
> > - for me to learn Ada
> > - as a proof-of-concept or illustration of the viability of Ada
> > - to compare and contrast number of lines of source code, memory
> > usage, speed etc.
> > - if it turns out well, as advocacy for Ada
> > - if it turns out ill, as a lesson learned, then I'll continue my
> > search for a good alternative to C
> >
> > I am open to suggestions.  I am thinking something from sbase or
> > ubase.
> 
> How did your approach turn out?

I haven't started re-writing anything yet.  I am reading Ada tutorials and
learning Ada.  Thanks for asking.  I'll let you know if/when I try it.



[dev] I just "discovered" programming language Nim

2021-05-02 Thread Greg Reagle
I just "discovered" programming language Nim.  Has anyone tried it?  Any 
reviews?  Looks very interesting.

https://nim-lang.org/



[dev] svtm

2021-04-24 Thread Greg Reagle
All of your programs/libraries get installed into /usr/local/bin except svtm 
which gets installed into $(HOME)/.local/bin  Why is that?  If you are going to 
stay with $HOME, then remove "sudo" from the last step of your installation 
instruction: 
[[git clone https://github.com/jeremybobbin/libst && \
cd libst && make && sudo make install && \
cd examples/svt && make && sudo make install && cd ../../../ && \
git clone https://github.com/jeremybobbin/sthkd && \
cd sthkd && make && sudo make install && cd ../ && \
git clone https://github.com/martanne/abduco && \
cd abduco && ./configure && make && sudo make install && \
git clone https://github.com/jeremybobbin/svtm && \
cd svtm && sudo make install
]]

You have sthkd as both its own git repo and as a subdirectory of libst.  I 
think you ought to choose one or the other.



Re: [dev] Ada not Rust

2021-04-24 Thread Greg Reagle
On Fri, Apr 23, 2021, at 22:12, Jeremy wrote:
> I wrote a library, libst(a fork of st), and modified st, dvtm to link 
> against it:
> https://github.com/jeremybobbin/libst
> 
> Try compiling & installing libst, then compile & run dvtm in libst/examples.

Okay, I am trying it.  I get [[dvtm.c:39:10: fatal error: 
/usr/local/include/libst.h: Permission denied]].  Add these chmod lines to your 
Makefile:
cp -f libst.a $(DESTDIR)$(PREFIX)/lib
chmod 644 $(DESTDIR)$(PREFIX)/lib/libst.a
cp -f libst.h $(DESTDIR)$(PREFIX)/include
chmod 644 $(DESTDIR)$(PREFIX)/include/libst.h

When I compile examples/dvtm, I get a page full of warnings.  Can you clean 
them up?

Would you be willing to provide a way (perhaps a Makefile target) to compile 
examples/dvtm with the extra checks that gcc and clang are capable of doing?  I 
mean things like -g, -fsanitize=address -fsanitize=undefined, -lasan -lubsan, 
and so forth.  Flags that are useful for debugging.

I tried examples/dvtm for one minute and it works okay, FYI.  I have to use it 
a lot longer than that to reproduce a crash though.



Re: [dev] Ada not Rust

2021-04-20 Thread Greg Reagle
On Tue, Apr 20, 2021, at 09:45, Jeremy wrote:
> Have a look at the arguments you can pass to "-fsanitize=" in gcc(1).

I am glad that you pointed that out to me--thank you.  Does clang have
comparable functionality?

I gave up on using dvtm a while ago (now I use tmux which is good) because it
would keep crashing.  And I could not figure out how to debug the crashes or get
specific information about the cause of the crashes.  If I had known about these
options then I would have compiled dvtm with them and maybe gave better bug
reports.  (Though I know C, I am not an expert in C.)

Can someone point me to an article or blog post recommending which of these
sanitize options would be recommended for general daily use?

Are there any operating systems or (Linux) distributions that use these run-time
checks by default, i.e. their binary packages are compiled with them?

If enabling these run-time checks adds 5%, 10%, or even 25% to the run time or
memory usage of a presumably already fast and small C binary executable, then it
is worth it to me.



Re: [dev] Ada not Rust

2021-04-20 Thread Greg Reagle
Thank you for your explanation Laslo Hunhold.  I wholeheartedly agree with you
about the fallibility of human programmers, and the vulnerability of C to
errors.  Even though I am a fan of the suckless philosophy and its programs,
which are written in C, I wish that a less error-prone language would be used.

Perhaps I will write (or more likely re-write a C program) a very small program
in Ada as a proof-of-concept of the viability of Ada for several purposes:
- for me to learn Ada
- as a proof-of-concept or illustration of the viability of Ada
- to compare and contrast number of lines of source code, memory usage, speed 
etc.
- if it turns out well, as advocacy for Ada
- if it turns out ill, as a lesson learned, then I'll continue my search for a 
good alternative to C

I am open to suggestions.  I am thinking something from sbase or ubase.

Ada is a big language with a lot of features.  I definitely intend to work with
a small subset of those features.



Re: [dev] Ada not Rust

2021-04-20 Thread Greg Reagle
On Mon, Apr 19, 2021, at 20:37, Samuel Holland wrote:
> On my machine (using musl), using `-largs -static` is sufficient to get a 
> fully
> static PIE executable:

Thank you.  (My machine has glibc).  I can do it now.

$ gnatmake hello -largs -static -bargs -static
$ ldd hello
not a dynamic executable

Of course it is big now: 1.2M.  I assume if I had musl it would be smaller.



Re: [dev] Ada not Rust

2021-04-19 Thread Greg Reagle
On Mon, Apr 19, 2021, at 16:36, Mattias Andrée wrote:
> For me, libgnat is only dynamically linked if I run gnatbind
> with -shared, but if you -static it should be statically linked.

Thank you.  [[ gnatmake hello.adb -bargs -static ]] does the trick, i.e. it
makes the executable larger (of course) by statically linking libgnat.  I am
still an Ada beginner so I am not running the linker and binder etc. separately.

> I cannot find how to statically link the C runtime.

Yea, it still is dynamically linked to (depends on) several libraries:
$ ldd hello
linux-vdso.so.1 (0x7ffe57fde000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x7ffbb8a93000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x7ffbb8a79000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x7ffbb88b8000)
/lib64/ld-linux-x86-64.so.2 (0x7ffbb8af5000)



[dev] Ada not Rust

2021-04-19 Thread Greg Reagle
On Sat, Apr 17, 2021, at 11:57, Laslo Hunhold wrote:
> Anyway, I can't say it enough: Check out Ada 2012 (and the SPARK
> subset) if you care about "secure" languages. It's not as lean as C, but
> you end up solving so many problems with it, especially in regard to
> software engineering and safety.

Okay, I did.  Very interesting.  I briefly studied Ada many years ago.  Do you 
think that Ada is a viable alternative to Rust?  Do you think it is a decent 
alternative to C for things like operating systems or utilities like sbase or 
ubase?

I made a Hello World program in Ada.  Very fast and small.  However, it depends 
on libgnat-8.so.1.  Is there a way to build it so that it does not?  Like 
statically linked?



[dev] Ada not Rust

2021-04-19 Thread Greg Reagle
On Sat, Apr 17, 2021, at 11:57, Laslo Hunhold wrote:
> Anyway, I can't say it enough: Check out Ada 2012 (and the SPARK
> subset) if you care about "secure" languages. It's not as lean as C, but
> you end up solving so many problems with it, especially in regard to
> software engineering and safety.

Okay, I did.  Very interesting.  I briefly studied Ada many years ago.  Do you 
think that Ada is a viable alternative to Rust?  Do you think it is a decent 
alternative to C for things like operating systems or utilities like sbase or 
ubase?

I made a Hello World program in Ada.  Very fast and small.  However, it depends 
on libgnat-8.so.1.  Is there a way to build it so that it does not?  Like 
statically linked?



Re: [dev] Completeness suckless

2021-04-09 Thread Greg Reagle
On Fri, Apr 9, 2021, at 11:42, Hadrien Lacour wrote:
> Where do we stop, though? For me, sh (even with all its braindamage)

Speaking of the brain damage of sh, I highly recommend rc [1] which is available
in 9base [2] and other sources like Plan 9 Port.

[1] http://doc.cat-v.org/plan_9/4th_edition/papers/rc
[2] https://tools.suckless.org/9base/




Re: [dev] [dwm][bug] Programs teleport tag on startup

2021-01-17 Thread Greg Reagle
DWM behaves as I expect it to behave.  It assigns the tag when the window is 
created.  Makes sense to me for a window manager.  I doubt that a change as you 
propose would be easy or simple, but prove me wrong. :>

On Sun, Jan 17, 2021, at 01:13, Spenser Truex wrote:
> To me this seems like undesirable behaviour, since after opening a
> program one has to wait for it to load before switching the current tag.
> 
> Reproduction:
> Run a program (eg. firefox) in tag 1
> Switch tag view before it loads to tag 2
> It gets labeled in tag 2, not tag 1.
> 
> Expect: use tag 1, not 2.
> 
> I can't imagine any way that this is desirable. I will try to patch a
> fix later, seems like low hanging fruit.
> --
> 7E7B 2078 A241 3205 F469  3B21 0AD4 8D58 F9FB DDC6
> Spenser Truexhttps://equwal.com
> 
> Attachments:
> * signature.asc



Re: [dev] can redo handle phony targets properly?

2021-01-14 Thread Greg Reagle
Thank you for the explanation.  To make sure that I understand, please tell me 
whether my statements are correct . . .

Redo cannot be told to ignore a target file.  If I happen to create a file with 
the same name as a phony target (e.g. "install"), then redo will refuse to run 
the rule.  The only workarounds are to rename or remove the file or rename the 
target.  There are good reasons that it works this way.

Is that correct?



Re: [dev] [st] When shrinking the width of a st window, overflowing text gets cut out and it is no longer retrievable, not even if the width is reset to the original one

2021-01-06 Thread Greg Reagle
On Wed, Jan 6, 2021, at 10:50, Lee Phillips wrote:
> I compiled the current version of this scroll program and used it with 
> both st and xterm. It had no effect.

No effect at all?  It is at least supposed to allow you to scroll back.  I 
suspect something is wrong with the way you're trying to use scroll.



Re: [dev] Build system: redo

2021-01-06 Thread Greg Reagle
On Wed, Jan 6, 2021, at 09:57, Sergey Matveev wrote:
> > clean)
> > redo-always
> 
> No need to add redo-always to the targets that only can be "called" by
> the human/user. User uses "redo" command, that forces specified targets
> to be rebuild. So "redo clean/dst/install/whatever" will always do the
> target. redo-always here is completely useless.

Thank you.  I applied this change.

> > install)
> 
> It misses "redo-ifchange st". It will fail if st was not built.

Thank you.  I applied this change.

Thanks for your feedback.



Re: [dev] Build system: redo

2021-01-06 Thread Greg Reagle
On Wed, Jan 6, 2021, at 08:52, Greg Reagle wrote:
> Here is my attempt at a redo file for st, instead of a Makefile.  I 

I have made one improvement already, adding this to the end of the case 
statement:
*)
echo "no rule to build '$1'" >&2
exit 1
;;



Re: [dev] Build system: redo

2021-01-06 Thread Greg Reagle
Here is my attempt at a redo file for st, instead of a Makefile.  I expect it 
is a complete replacement.  If it interests any of you, please take a look and 
give me constructive criticism.  Does it have any flaws?  Could it be improved? 
 I know that there are advantages to having the .do files separated, so there 
is no need to mention that.  I am choosing one big file for my learning [1].

Attached and included.  Thanks in advance.

[1] 
https://redo.readthedocs.io/en/latest/FAQSemantics/#can-i-put-all-my-rules-in-one-big-redofile-like-make-does


CC=${CC:-cc}
VERSION=0.8.4
PREFIX=/usr/local
MANPREFIX=${PREFIX}/share/man
X11INC=/usr/X11R6/include
X11LIB=/usr/X11R6/lib
PKG_CONFIG=pkg-config

INCS="-I${X11INC}"
INCS="$INCS `${PKG_CONFIG} --cflags fontconfig`"
INCS="$INCS `${PKG_CONFIG} --cflags freetype2`"

LIBS="-L${X11LIB} -lm -lrt -lX11 -lutil -lXft"
LIBS="$LIBS `${PKG_CONFIG} --libs fontconfig`"
LIBS="$LIBS `${PKG_CONFIG} --libs freetype2`"

STCPPFLAGS="-DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600"
STCFLAGS="${INCS} ${STCPPFLAGS} ${CPPFLAGS} ${CFLAGS}"
STLDFLAGS="${LIBS} ${LDFLAGS}"

SRC="st.c x.c"
OBJ="st.o x.o"

case "$1" in
# Actual file targets in alphabetical order
config.h)
cp config.def.h "$3"
;;
st)
redo-ifchange $OBJ
$CC -o "$3" $OBJ $STLDFLAGS
;;
*.o)
source="${1%.o}.c"
redo-ifchange "$source" `sed -n 's/#include "\(.*\)"$/\1/p' 
"$source"`
$CC $STCFLAGS -o "$3" -c "$source"
;;
# ".Phony" targets in alphabetical order
all)
redo-ifchange st
;;
clean)
redo-always
rm -f st $OBJ st-"$VERSION".tar.gz
;;
dist)  # this creates an actual file, but it's not called "dist"
redo-always
mkdir -p st-"$VERSION"
cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\
   config.def.h st.info st.1 arg.h st.h win.h $SRC\
   st-"$VERSION"
tar -cf - st-"$VERSION" | gzip > st-"$VERSION".tar.gz
rm -rf st-"$VERSION"
;;
install)
redo-always
exec >&2
mkdir -p "$DESTDIR$PREFIX"/bin
cp -f st "$DESTDIR$PREFIX"/bin
chmod 755 "$DESTDIR$PREFIX"/bin/st
mkdir -p "$DESTDIR$MANPREFIX"/man1
sed "s/VERSION/$VERSION/g" < st.1 > 
"$DESTDIR$MANPREFIX"/man1/st.1
chmod 644 "$DESTDIR$MANPREFIX"/man1/st.1
tic -sx st.info
echo Please see the README file regarding the terminfo entry of 
st.
;;
uninstall)
redo-always
rm -f "$DESTDIR$PREFIX"/bin/st
rm -f "$DESTDIR$MANPREFIX"/man1/st.1
;;
esac


default.do
Description: Binary data


Re: [dev] Build system: redo

2021-01-03 Thread Greg Reagle
On Sun, Jan 3, 2021, at 14:16, Sergey Matveev wrote:
> "all" target is useful only as a default rule that is run by many
> implementations by default and you have just to type "redo" to build the
> program.

Yes, agreed.

> Everything looks good. But I am just curious: why do you use
> 
> printf 'recompiling %s\n' $2.c >&2
> printf 'relinking\n' >&2
> 
> instead of?:
> 
> echo recompiling $2.c >&2
> echo relinking >&2

I am in the habit of using printf rather than echo because of the drawbacks of 
echo as explained in 
https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo.  
For
  echo relinking
specifically, it doesn't matter.  For 
  echo recompiling $2.c
specifically, if $2 contains any characters that echo might interpret, it might 
come out wrong.

> In my opinion the later is easier to read and understand.

Yes I agree that the echo is a bit simpler and easier than the printf, but it
has disadvantages.

> And personally I am pretty against that kind of messages.

They are educational messages for me because I am learning.

Thank you for your feedback.  I am grateful.



Re: [dev] Build system: redo

2021-01-03 Thread Greg Reagle
Thank you very much Sergey Matveev.  I have studied your proposed redo files 
for st and learned a lot.  Here are my new and improved (you had a bug in 
default.o.do in that you forgot to depend on $src) redo files for st.  Please 
take a look and tell me what you think.

Note that there are neither 'options' nor 'all' targets for simplicity--I don't 
that they are very useful.  The redo command has the -x and -v options if you 
want more details.  Also, I de-automated your automatic generation of the 
source (.c) and object (.o) files because it didn't work properly as you 
discussed in your message.  If it's going to be automatic, I want it to work 
automatically.

 config.rc 

CC=${CC:-cc}
VERSION=0.8.4
PREFIX=/usr/local
MANPREFIX=${PREFIX}/share/man
X11INC=/usr/X11R6/include
X11LIB=/usr/X11R6/lib
PKG_CONFIG=pkg-config

INCS="-I${X11INC}"
INCS="$INCS `${PKG_CONFIG} --cflags fontconfig`"
INCS="$INCS `${PKG_CONFIG} --cflags freetype2`"

LIBS="-L${X11LIB} -lm -lrt -lX11 -lutil -lXft"
LIBS="$LIBS `${PKG_CONFIG} --libs fontconfig`"
LIBS="$LIBS `${PKG_CONFIG} --libs freetype2`"

STCPPFLAGS="-DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600"
STCFLAGS="${INCS} ${STCPPFLAGS} ${CPPFLAGS} ${CFLAGS}"
STLDFLAGS="${LIBS} ${LDFLAGS}"

OBJ="st.o x.o"

 clean.do 

redo-ifchange config.rc
. ./config.rc
rm -f st $OBJ st-${VERSION}.tar.gz

 default.o.do 

src=$2.c
redo-ifchange $src config.rc `sed -n 's/#include "\(.*\)"$/\1/p' $src`
. ./config.rc
printf 'recompiling %s\n' $2.c >&2
$CC $STCFLAGS -o $3 -c $2.c

 st.do 

redo-ifchange config.rc
. ./config.rc
redo-ifchange $OBJ
printf 'relinking\n' >&2
$CC -o $3 $OBJ $STLDFLAGS



Re: [dev] Build system: redo

2020-12-18 Thread Greg Reagle
Thanks very much for you comprehensive and thorough reply.  I'll be studying it 
over the course of many days.  I disagree with your first point though, so read 
on.

On Fri, Dec 18, 2020, at 05:08, Sergey Matveev wrote:
> Just a remark: when using "basic" features of redo, just what DJB
> described, there is no difference between various redo implementations.
> I used apenwarr/redo, apenwarr/do, redo-c and goredo with the same
> project, with the same .do-files without any modifications and behaviour
> differences.

According to its README, redo-c does *not* capture standard output by default.  
So I would think you would have to use it differently, either by using the -s 
option or setting the  environment variable REDO_STDOUT.  Or maybe all your .do 
files write to $3 rather than stdout?



Re: [dev] Build system: redo

2020-12-17 Thread Greg Reagle
I would love to see an example, Make translated to apenwarr redo.  I would 
learn best seeing a real but fairly simple project's Makefile implemented in 
apenwarr redo, so I can look at both ways of doing it.  Like st for example.



[dev] announcing tec: temporary email commands

2020-10-21 Thread Greg Reagle
I re-wrote tec as one command.  I used action flags rather than sub-commands 
because it seemed to be easier to code for me.  For those who want to check out 
the new UI:  https://github.com/GReagle/tec



[dev] Re: [hackers] announcing tec: temporary email commands

2020-10-21 Thread Greg Reagle
I am replying on dev since it seems more appropriate.

On Wed, Oct 21, 2020, at 05:06, Cág wrote:
> This reminds me of how I use mblaze.  Instead of using the plethora of
> small commands for my own convenience I made a single script to call them
> using arguments.

May I see the single script please?



[dev] dwm: mod key improvement

2020-08-04 Thread Greg Reagle
>From the time I started using dwm (many months or years ago--my long term 
>sense of time is very inaccurate and imprecise) until today, I have been using 
>it with:
#define MODKEY Mod4Mask

Today I had the brilliant idea to instead use:
  #define MODKEY Mod5Mask
To make this work, I remapped a key in ~/.xmodmaprc thusly:
keycode 110 = ISO_Level3_Shift

So that's the background, the point is now I have a whole new modifier key 
(i.e. Mod4 aka Super aka Windows-flag) available to all my applications.  Any 
ideas on how to utilize this newfound opportunity?  Are there any applications 
that use Super/Mod4?

By the way, I don't use the dwm default of 
#define MODKEY Mod1Mask
because I want all Alt key combinations to be available to applications.



Re: [dev] st mouse binding with scroll

2020-06-23 Thread Greg Reagle
On Sun, Jun 21, 2020, at 21:38, Kai Hendry wrote:
> Since the mouse wheel bindings are disabled by default in scroll, what 
> are the alternative bindings people can suggest?
> 
> https://git.suckless.org/scroll/file/config.def.h.html
> 
> Would be kindof awesome to be able to scroll with a mouse.

Hello.  Did you get this resolved yet?  I don't think I completely understand 
your question.

-- 
Contact me:  I am available on SIP, Matrix/Riot, and Jami.  Just ask for my 
address.



Re: [dev] st: use mouse to paste from clipboard

2020-06-23 Thread Greg Reagle
On Tue, Jun 23, 2020, at 03:27, Kai Hendry wrote:
> Hi Greg, have you seen https://st.suckless.org/patches/clipboard/ ?

I hadn't.  I just looked at it.  I don't think it does what I want.

-- 
Contact me:  I am available on SIP, Matrix/Riot, and Jami.  Just ask for my 
address.



Re: [dev] st: use mouse to paste from clipboard

2020-06-22 Thread Greg Reagle
On Mon, Jun 22, 2020, at 22:38, Ivan Tham wrote:
> On Mon, Jun 22, 2020 at 07:03:13AM -0400, Greg Reagle wrote:
> >I can easily paste from the primary selection using middle mouse button 
> >(Button2), or with the keyboard (Ctrl-Shift-y).  To paste from the clipboard 
> >I can use the keyboard (Ctrl-Shift-v), but there is no way to do it with the 
> >mouse.
> >
> >Wouldn't it be great to be able to paste from the clipboard selection, using 
> >the mouse?  I think so.  Would the maintainer of st like to make this part 
> >of st?  Here is the line that I added to mkeys[] in config.h
> >
> >{ Button3,  XK_NO_MOD,  clippaste,  {.i =  0}},

> No, if you overwrite to paste from clipboard,

I am not suggesting overwriting anything.  I don't understand your response.

> how do you paste from primary selection?

As I mentioned in the text that you quoted, "using middle mouse button 
(Button2), or with the keyboard (Ctrl-Shift-y)".  This is already built into st.

By the way, I am using st 0.8.2, in case that has any relevance to our 
discussion.

-- 
Contact me:  I am available on SIP, Matrix/Riot, and Jami.  Just ask for my 
address.



Re: [dev] st mouse binding with scroll

2020-06-22 Thread Greg Reagle
On Sun, Jun 21, 2020, at 21:38, Kai Hendry wrote:
> Since the mouse wheel bindings are disabled by default in scroll, what 
> are the alternative bindings people can suggest?
> 
> https://git.suckless.org/scroll/file/config.def.h.html
> 
> Would be kindof awesome to be able to scroll with a mouse.

I don't quite understand how to answer your question about scroll.  But I will 
tell you what I do to have working wheel scrolling in st:  I use st-0.8.2 and 
patches st-scrollback-0.8.2.diff, st-scrollback-mouse-0.8.2.diff, 
st-scrollback-mouse-increment-0.8.2.diff.  I have configured config.h so that 
Control+mouse_wheel is slow scrolling and Alt+mouse_wheel is fast scrolling:

const unsigned int mousescrollincrement = 40;
static MouseShortcut mshortcuts[] = {
/* button   maskstring
{ Button4,  ShiftMask,  "\020" },
{ Button5,  ShiftMask,  "\016" }, */
};

MouseKey mkeys[] = {
/* button   maskfunctionargument */
{ Button4,  XK_NO_MOD,  kscrollup,  {.i =  
mousescrollincrement} },
{ Button5,  XK_NO_MOD,  kscrolldown,{.i =  
mousescrollincrement} },
{ Button4,  ControlMask,kscrollup,  {.i =  
mousescrollincrement / 2} },
{ Button5,  ControlMask,kscrolldown,{.i =  
mousescrollincrement / 2} },
{ Button4,  Mod1Mask,   kscrollup,  {.i =  
mousescrollincrement * 2} },
{ Button5,  Mod1Mask,   kscrolldown,{.i =  
mousescrollincrement * 2} },
};

I don't understand the purpose of mshortcuts.  It doesn't seem to work.

-- 
Contact me:  I am available on SIP, Matrix/Riot, and Jami.  Just ask for my 
address.



Re: [dev] st mouse binding with scroll

2020-06-22 Thread Greg Reagle
On Mon, Jun 22, 2020, at 06:46, Greg Reagle wrote:
> I don't understand the purpose of mshortcuts.  It doesn't seem to work.

Actually, I do understand it, and it doesn't work because I commented it out.  
Sorry--it's early in the morning and I just woke up.  mshortcuts works fine, 
but I haven't been able to think of something useful to do with it. 

-- 
Contact me:  I am available on SIP, Matrix/Riot, and Jami.  Just ask for my 
address.



[dev] st: use mouse to paste from clipboard

2020-06-22 Thread Greg Reagle
I can easily paste from the primary selection using middle mouse button 
(Button2), or with the keyboard (Ctrl-Shift-y).  To paste from the clipboard I 
can use the keyboard (Ctrl-Shift-v), but there is no way to do it with the 
mouse.

Wouldn't it be great to be able to paste from the clipboard selection, using 
the mouse?  I think so.  Would the maintainer of st like to make this part of 
st?  Here is the line that I added to mkeys[] in config.h

{ Button3,  XK_NO_MOD,  clippaste,  {.i =  0}},

-- 
Contact me:  I am available on SIP, Matrix/Riot, and Jami.  Just ask for my 
address.



[dev] Re: [hackers] [st] support REP (repeat) escape sequence || Avi Halachmi (:avih)

2020-05-16 Thread Greg Reagle
On Sat, May 16, 2020, at 08:09, g...@suckless.org wrote:
> support REP (repeat) escape sequence
>
> This is Ecma-048/ANSI-X3.6 sequence and not DEC VT. It's supported by
> xterm, and ncurses uses it when possible, e.g. when TERM is xterm* (and
> with this commit also st*).
> To test:
> - tput rep 65 4 -> prints ''

When I run xterm (Debian stable version 344-1) (TERM is xterm) and enter the 
command 'tput rep 65 4', the terminal does not print 4 A's; it prints nothing 
(next line is the shell prompt).  Same behavior for rxvt-unicode version 9.22-6 
(TERM is rxvt-unicode-256color) and xfce4-terminal version 0.8.7.4-2 (TERM is 
xterm-256color) .  Am I doing something wrong or misunderstanding something?  
Does the shell matter?  My default shell is fish but I've tried with bash too.



Re: [dev] [dwm] Window layout gets corrupted when using xca

2020-05-08 Thread Greg Reagle
I tried to reproduce the bug, but I could not.  dwm worked fine.

-- 
Contact me:  I am available on SIP, Matrix/Riot, and Jami.  Just ask for my 
address.



Re: [dev] [st] Copy from st and paste to Chrome, cause Chrome crash

2020-04-06 Thread Greg Reagle
On Sun, Apr 5, 2020, at 23:42, Damon wrote:
> I am using: 
> st 0.8.2 with these patches: font2, scrollback, scrollback-mouse, 
> scrollback-mouse-altscreen. 
> Chrome 80.0 
> bspwm
> 
> If I ctrl+shift+c copy something in ST, I can not paste it in Chrome. 

I do not experience this problem.  I also don't use the same st patches as you. 
 I use dwm.

Here are my versions:
Chromium: Version 80.0.3987.132 (Developer Build) built on Debian 10.3, running 
on Debian 10.3 (64-bit)
st:  HEAD detached at 3be4cf1 (st 0.8.1) with 
st-scrollback-20190122-3be4cf1.diff

I suggest that you try st without any patches to see whether the bug is still 
there.  Also try the latest st and a different window manager to see if they 
make a difference.

My intuition/impression is that posting a bug report for a program on this list 
has a chance (and not a big chance) of a meaningful/helpful response if and 
ONLY IF the bug occurs in the latest version without patches.  Even then, we've 
got some people who will reply with "Where's the patch?".  But, fortunately, we 
do have some maintainers who prefer a bug report without a patch over no bug 
report at all.



Re: [dev] Scrollback utility for use with st

2020-04-06 Thread Greg Reagle
On Mon, Apr 6, 2020, at 04:40, Laslo Hunhold wrote:
> On Mon, 06 Apr 2020 08:48:38 +0200
> "Silvan Jegen"  wrote:
> But how often do you get some output and think "oh, I
> actually needed that"

Yes that happen to me occasionally, which is why I use the scrollback patch for 
st.  I find it much easier to hit Shift+PageUp than to rerun a command.  And 
when the output of a command changes with time, re-running it might not get the 
same output.

> This is exactly the anti-pattern I pointed out. Given windows are not
> kept at fixed sizes in a tiling wm, st _especially_ needs to satisfy
> that it is not "affected" by resizes.

I use dwm so my windows are resized a lot.  It would be great if st could be 
resized without losing text.  I notice that dvtm and tmux handle a shrinking 
window differently.  In dvtm, the text is just cut off; in tmux, the text is 
wrapped.  Both of them restore the text properly when the window is enlarged 
again.  I think I like the dvtm (truncation) way better, but I don't really 
know or care that much.  The important thing is that the text is not lost.



Re: [dev] Scrollback utility for use with st

2020-04-05 Thread Greg Reagle
On Sun, Apr 5, 2020, at 06:57, Laslo Hunhold wrote:
> On Sun, 5 Apr 2020 12:11:09 +0200
> Georg Lehner  wrote:
> > A question: why is the scrollback-patch not included in `st` already
> 
> exactly my point. I see no reason why there can't at least be a
> scrollback, which defaults to 0 in config.h.
> Wouldn't this make all sides happy?

Now I am thinking that it would be good idea to have a scrollback program 
and/or library that is used by st, xterm, dvtm, tmux, splitvt, mtm.  For those 
programs that do not come with a scrollback feature, this would add the 
scrollback feature with very little (scrollback library) or no (scrollback 
program) extra code.  For some of those programs that already have the feature, 
stripping out their custom code would reduce complexity.  If all of these 
programs used the same program/library, there would be a consistent user 
interface which would be really nice.

I think that some people consider a scrollback buffer in st to be feature 
bloat, so they keep it out of the main line and force it into an extra patch.  
The attitude is: If you want scrollback, use dvtm or tmux, or the scrollback 
patch, or do things in a Plan 9 sort of way (which I am not too familiar with).

When I first learned of st, this attitude really baffled me.  How could a 
scrollback feature in a terminal be considered extraneous?  Now that I've 
learned more about suckless and about how Plan 9 works (though Plan 9 still 
confuses me, I haven't completely wrapped my head around it), it doesn't seem 
so crazy.  But still, I always use the scrollback patch for st.



Re: [dev] Scrollback utility for use with st

2020-04-02 Thread Greg Reagle
On Wed, Apr 1, 2020, at 16:51, Lehner Georg wrote:
> That is absolutely great! R.I.P `sb`.

If a standalone scrollback program were good enough, could it be used to 
replace the scrollback code in tmux, dvtm, xterm?  Would that be a good idea?  
Do you think the developers of these programs would be willing to remove their 
scrollback code and depend on a standalone scrollback program?

DVTM has this really nice feature, the ability to see the scrollback buffer in 
an editor.  I'd like to get access to the scrollback buffer with an editor or 
pager (like less).  I don't want to have to learn a new and different way to 
search through the scrollback buffer for tmux, dvtm, screen, etc.  I already 
know emacs (pretend I wrote "vi" if that offends you) and less.  Duplication of 
scrollback code also is an opportunity for more bugs.

By the way, if I can get access to the scrollback buffer in less, then I 
automatically get access to it in an editor, because less has the v command.



Re: [dev] user interfaces on top of ii

2020-02-25 Thread Greg Reagle
On Mon, Feb 24, 2020, at 11:54, Evan Gates wrote:
> I had no idea anyone actually used pcw.  I feel like I should warn you
> that I wrote that code a long time ago and it is most likely complete
> shit.  Awesome that it seems to work for you though!

It works great for me.  I have called (executed) it many times.  FYI, I am 
using it to experiment with interfaces on top of ii.



[dev] Re: experimenting with ii, question about a script

2020-02-22 Thread Greg Reagle
Now it works with pcw!  Very much like lchat.

Put this in  pcw_win.sh:
exec dvtm-ii "$CPATH"

and here is the script, which I named dvtm-ii

#!/bin/sh
set -u

trap cleanup INT TERM QUIT
cleanup() { kill $!; }  # make st end when this script does

[ -d "$1" -a -r "$1"/out -a -p "$1"/in ] || exit 1
cmd_fifo=$(mktemp -u) || exit 1
mkfifo "$cmd_fifo" || exit 1
title="$(basename $(dirname "$1"))/$(basename "$1")"
st -e dvtm -M -h 1 -t "$title" -c "$cmd_fifo" "exec nano -nw \"$1/in\"" 
"exec tail -n +0 -f \"$1\"/out" &

delay="0.09" # dvtm crashes unless pause at leat 0.07 seconds
# I had to customize dvtm to allow these commands to the command fifo, and it
# was very easy to do so.  They are based on the keyboard commands.  If you
# haven't customized dvtm, you can just comment out this next paragraph
{
for cmd in b j l l l l l l; do
sleep "$delay"
echo "$cmd"
done
} >"$cmd_fifo"

wait # wait for st



[dev] experimenting with ii, question about a script

2020-02-22 Thread Greg Reagle
I am new to ii and experimenting and learning.  I had the thought, "Why 
re-invent the wheel?"  Questions and comments are welcome.  I am sharing my 
thoughts.

For a little program that deals with an in and an out file, like lchat or xii 
[1], I need only three features: an out-displayer, an in-sender, and a 
combiner.  These tools already exist, so no need to write a new GUI or curses 
TUI etc.

For the out-displayer, I want these features: scrolling to see all output, 
select and copy, notification when out grows.  For the in-sender: edit text and 
send text to in file.  For the combiner: make the out-displayer real big and 
put the in-sender real small below it.

For the out-displayer, use "tail -n +0 -f out" in a dvtm window and I get all 
the features except notification.
For the in-sender, use "nano -nw in" in a dvtm window.  Of course you could 
choose a different editor.  For the combiner I use dvtm.  It allows me to 
combine the two components, set their relative size and position.  It also 
provides scrolling and access to the scrollback buffer, and select and copy and 
paste.

So here is the script.  Note that my-dvtm is just an extremely simple shell 
script that sets a few options that I prefer (e.g. bigger scrollback buffer). I 
could not figure out how to make this script work without calling a new 
terminal window (st). If I put dvtm into the background (calling dvtm directly 
without st) I get all sorts of problems.  Is it possible?  Any other 
improvements could be made to this script?

#!/bin/sh
set -u
[ -d "$1" -a -r "$1"/out -a -p "$1"/in ] || exit 1
cmd_fifo=$(mktemp -u) || exit 1
mkfifo "$cmd_fifo" || exit 1
st -e my-dvtm -c "$cmd_fifo" "nano -nw \"$1/in\"" "tail -n +0 -f \"$1\"/out" &

d="0.09" # dvtm crashes without pausing at leat 0.07 seconds
# I had to customize dvtm to allow these commands to the command fifo, and it
# was very easy to do so.  They are based on the keyboard commands.
{
for cmd in b j l l l l l l; do
sleep "$d"
echo "$cmd"
done
} >"$cmd_fifo"


[1] https://tools.suckless.org/ii/usage/



[dev] user interfaces on top of ii

2020-02-20 Thread Greg Reagle
On Thu, Feb 20, 2020, at 15:33, Greg Reagle wrote:
> I am not very familiar with IRC or with ii (I've used IRC very very 
> little).  Could you recommend and IRC client that works on top of ii 
> that is fairly easy to use, not requiring a lot of scripting and setup 
> and so forth?  Maybe something on the level of mutt?  So that I can get 
> an idea of how to make a friendly UI on top of the FIFOs.

I have figured out how to use pcw with multiple st windows running lchat.  I 
understand the general idea now.  I have this in pcw_win.sh:
exec st -t "$CPATH" -e lchat -n30 -p "$(basename "$CPATH")> " -t "$(basename 
"$CPATH")>"  "$CPATH"



Re: [dev] an approach to Matrix client that sucks less

2020-02-20 Thread Greg Reagle
Thank you Laslo Hunhold for your feedback.

On Thu, Feb 20, 2020, at 14:54, Laslo Hunhold wrote:
> yes, we haven't looked into Matrix much here. I have to admit that it's
> the most promising protocol out there, in my opinion. What matters for
> a suckless client is the interface. 

Based on your other comments, I assume that when you stress the importance of 
the "interface", you are not referring to end-user interface (like command 
line, or curses, or GTK, etc.) but more of a lower level interface, like the 
way that ii works with files and directories and FIFOs?

> A few years ago, Dimitris, Hiltjo,
> I and a few others wrote a client for toxcore, and we kept it similar
> to ii with a file based hierarchy. The client itself was event-driven
> and had a pretty sophisticated state machine to handle the different
> states. We even supported calls and file transfers, but sadly, tox died
> due to internal conflicts and an inconsistent API.

Are you referring to https://git.2f30.org/ratox/file/README.html.  Are you 
suggesting that I use it as a template for the interface (along with ii).

> Investigating Matrix is definitely a nice thing! I am not a big fan of
> Lua though,

I am certainly open to suggestions to other languages.  If using a different 
language can get me more contribution from others, that would be very valuable 
to me indeed.  But I do want something higher level than C.

> but what matters is the interface. From that point on, it
> shouldn't matter which language you use to implement it.

I understand.

I am not very familiar with IRC or with ii (I've used IRC very very little).  
Could you recommend and IRC client that works on top of ii that is fairly easy 
to use, not requiring a lot of scripting and setup and so forth?  Maybe 
something on the level of mutt?  So that I can get an idea of how to make a 
friendly UI on top of the FIFOs.



Re: [dev] startup time of some interpreters

2020-02-20 Thread Greg Reagle
On Thu, Feb 20, 2020, at 12:48, Eric Pruitt wrote:
> One problem I see with these benchmarks is that it's not an entirely
> fair comparison. For example, in Python, you're only printing some text,
> but you aren't importing any modules.

That's true, but I was just comparing the overhead of the interpreter itself.



Re: [dev] startup time of some interpreters

2020-02-20 Thread Greg Reagle
On Thu, Feb 20, 2020, at 13:07, Hadrien Lacour wrote:
> Why would it be "defective" other than sh or I/O adding time noise?

Because I am a flawed and imperfect person who makes mistakes, and while I 
consider myself a competent programmer, I know that there are people here on 
suckless who are experts and consider things that I overlook.

> lua is a very simple language with a light reference interpreter.

Yes, that is my point.

> A much more accurate mesure of disgust is the number of syscall made for such 
> a
> simple task:

That's very interesting, thank you.  Do you know how to write a similar test 
for memory usage?




[dev] startup time of some interpreters

2020-02-20 Thread Greg Reagle
Hello. I am amazed at how fast Lua is to start up and shut down. Is my 
benchmark defective in any way? Lua seems to start up and exit faster than 
bash, python, rc, and ksh. Dash and mksh are faster. These interpreters are all 
packages from Debian Stable 10 "Buster".

/usr/bin/time sh -c 'for i in $(seq 1 200); do dash -c "echo \"hello\""; done' 
> /dev/null
0.12user 0.04system 0:00.17elapsed 97%CPU (0avgtext+0avgdata 1728maxresident)k
0inputs+0outputs (0major+16728minor)pagefaults 0swaps

/usr/bin/time sh -c 'for i in $(seq 1 200); do mksh -c "echo \"hello\""; done' >
/dev/null
0.16user 0.05system 0:00.23elapsed 96%CPU (0avgtext+0avgdata 1904maxresident)k
0inputs+0outputs (0major+18472minor)pagefaults 0swaps

/usr/bin/time sh -c 'for i in $(seq 1 200); do lua -e "print \"hello\""; done' >
/dev/null
0.22user 0.07system 0:00.31elapsed 97%CPU (0avgtext+0avgdata 2496maxresident)k
0inputs+0outputs (0major+25334minor)pagefaults 0swaps

/usr/bin/time sh -c 'for i in $(seq 1 200); do bash -c "echo \"hello\""; done' 
> /dev/null
0.26user 0.09system 0:00.36elapsed 96%CPU (0avgtext+0avgdata 3240maxresident)k
0inputs+0outputs (0major+30253minor)pagefaults 0swaps

/usr/bin/time sh -c 'for i in $(seq 1 200); do ksh -c "echo \"hello\""; done' > 
/dev/null
0.28user 0.14system 0:00.44elapsed 95%CPU (0avgtext+0avgdata 3888maxresident)k
0inputs+0outputs (0major+37146minor)pagefaults 0swaps

/usr/bin/time sh -c 'for i in $(seq 1 200); do /usr/lib/plan9/bin/rc -c "echo 
\"hello\""; done' > /dev/null
0.43user 0.14system 0:00.60elapsed 96%CPU (0avgtext+0avgdata 2008maxresident)k
0inputs+0outputs (0major+43700minor)pagefaults 0swaps

/usr/bin/time sh -c 'for i in $(seq 1 200); do python -c "print \"hello\""; 
done' > /dev/null
2.32user 0.88system 0:03.32elapsed 96%CPU (0avgtext+0avgdata 7220maxresident)k
0inputs+0outputs (0major+174760minor)pagefaults 0swaps





[dev] an approach to Matrix client that sucks less

2020-02-20 Thread Greg Reagle
Hi y'all.  I don't see any Matrix client at https://suckless.org/rocks/ or 
https://suckless.org/other_projects/ and I am thinking of making one.  I use 
the Riot.im web app client which has a lot of features, but is bloated.

Do any of you know of a Matrix client that is not bloated?  I have looked at 
many of the clients at https://matrix.org/clients.  I have tried several.  Some 
of them are either too bloated, use a language I'm not crazy about, or lack 
some basic features (too immature).  

I have never used Weechat and am feeling too lazy to learn.  I expect there 
would be a lot to learn just to use it as an IRC client, then as a Matrix 
client I don't know how well it works.  I am reluctant to invest the time and 
effort (but maybe I should, I don't know).

I might write my own Matrix client.  I would probably use Lua.  C is too low 
level for my taste.  Would any of you be interested in contributing?  I expect 
I would start by writing command line interface.  CLI would be good to have, 
and I could learn a lot about implementing Matrix without being bothered by UI 
issues.  After the CLI was done, then I would consider what to do next, maybe a 
GUI, maybe a TUI, etc.



Re: [dev] [surf] can't follow a link for download

2020-02-20 Thread Greg Reagle
On Thu, Feb 20, 2020, at 08:26, Renato A. Galvão wrote:
> I use the packaged version buster (stable) of surf in Debian.
> 
> While trying to make any download I'm receiving this:
> 
> surf: execvp x-terminal-emulator failed: Permission denied

Run the command x-terminal-emulator from a shell prompt.  What happens?

Also, try these commands:
ls -l $(which x-terminal-emulator)
ls -l /etc/alternatives/x-terminal-emulator



Re: [dev] 9base mk doesn't work with subscripts?

2019-11-24 Thread Greg Reagle
On Sun, Nov 24, 2019, at 18:13, Marc Chantreux wrote:
> but when building index.html from index.md, i got
> 
> mkpage index.md template(1) > $target
> 
> instead of
> 
> mkpage index.md template(1) > $target

These two lines look exactly the same to me.  Did *I* miss something?  Also, 
what command do you *want* it to run?



[dev] multi-column text editing and viewing like tcvt

2019-09-21 Thread Greg Reagle
Greetings.  I just discovered (or more probably, discovered a long time ago, 
forgot about, and rediscovered) multi-column text editing and viewing.  And I 
am thinking this is very useful, especially with the modern craze for wide 
screens.  I am referring to the feature implemented by Emacs follow mode [1] 
and tcvt [2].  I can even run htop in multiple columns with tcvt which is 
pretty cool.

So, my questions for you are:  Do you use this feature?  Do you achieve a 
similar goal in a different way?  Are there any other programs that have this 
feature?  Maybe an implementation of vi?

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Follow-Mode.html
[2] http://subdivi.de/~helmut/tcvt/



Re: [dev] Pandoc replacement that sucks less

2019-04-28 Thread Greg Reagle
What about Discount (http://www.pell.portland.or.us/~orc/Code/discount/) ?



Re: [dev] Pandoc replacement that sucks less

2019-04-28 Thread Greg Reagle
Is there any problem with pandoc.  You mention that it takes 420 MB.  Is that 
the only complaint you have with it?  Otherwise, it seems to be meeting all 
your goals?  You could buy a bigger hard drive.

There is a markdown program [1] which seems to be very small, which will get 
you from markdown to HTML.  From there maybe you can find an HTML-to-PDF 
converter that you like.

You could also try org mode for emacs which can export to PDF (via LaTex I 
think) but I suspect that will be very large.  But maybe you already use emacs. 
 Perhaps vi has some sort of equivalent.

[1] https://daringfireball.net/projects/markdown/



Re: [dev] [dwm] new release - transition from Openbox

2019-02-05 Thread Greg Reagle
On Mon, Feb 4, 2019, at 20:03, Sean MacLennan wrote:
> One of the big pluses is pinning an app to a workspace. When I boot, I
> get two xterm windows in workspace 1, a browser in workspace 2, and my
> email client in workspace 3.

That's intriguing.  Would you please explain how to do this?



Re: [dev] Web development in C (or, C'ing clearly through the webs of bias)

2019-02-02 Thread Greg Reagle
On Sat, Feb 2, 2019, at 05:21, Ciprian Dorin Craciun wrote:
> C is not "suckless" based on the above ides:
> * C is not minimal;  (I understand "why" it is not minimal, but this
> is besides the point;)
> * C is not as usable as other languages;  (how many times have we as
> developers rewritten linked-lists?  how would one describe using a
> hash-map library in C?)
> * C code is not "clear";  (just having `void *` as structure members
> and callback arguments, using `int` as "descriptors", etc.;)
> * C code is complex;  (try concatenating a few strings together;)

I've been on this list a few years too.  I completely agree with these 
criticisms of C.

On the other hand, higher level languages than C that overcome these particular 
problems have other problems, so I don't know of a great alternative.  Shell 
scripting with rc is a pretty good higher level language, for its special 
purpose, but of course its scope is limited.



Re: [dev] surf

2019-01-26 Thread Greg Reagle
On Sat, Jan 26, 2019, at 15:58, Igor Rubel wrote:
> I've just installed surf using MacPorts.
> 
> > surf https://www.apple.com/
> > Can't open default display
> 
> How can one solve that?

Hi.  My guess, and it is just a wild guess because I don't even own an 
Apple/Mac (although I have used them at work before), is that surf is expecting 
an X server and that you are not running an X server.  My understanding is that 
MacOS's native/default display system in not X11.  The solution would be to 
install and run an X server.



  1   2   3   4   >