[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ibuffer: w and B default to buffer at current line

From: John Wiegley
Subject: Re: Ibuffer: w and B default to buffer at current line
Date: Thu, 15 Sep 2016 15:05:20 -0700
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1 (darwin)

>>>>> Tino Calancha <address@hidden> writes:

> If you compare the first patch with `dired-get-marked-files' (d-g-m-f) you
> might change your mind: (d-g-m-f) returns a list with the file at point when
> there are no marked files. The first patch follow similar idea.

I understand dired may also be taking this bad approach, but that's not a good
reason to continue the practice.

The end goal you're trying to achieve is to make a keystroke more intuitive.
That's a great goal. What it sounds like to me is that we need another layer
above ibuffer-get-marked-files: a command that, if there are marked buffers,
calls ibuffer-get-marked-files, and if there are no marked buffers, calls
ibuffer-current-buffer. Then it's clear to the reader what the command means,
and what is happening, and each function has exactly one job to do.

Monkey-patching Emacs to make single-purpose functions more magical by adding
special arguments -- or special meanings to arguments -- will burden us with
unnecessary technical debt in the future. I don't like this practice, and I'm
unmoved by "prior art" as a justification.

That said, again, I'm 100% in support of the end goal you want to achieve; I
just want to get there in a more principled way. Functions should do what they
say, and not have lots of alternative functionality baked into them because
it's a convenient hack today.

John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]