* bug#21578: `ibuffer-copy-filename-as-kill' unconsistent with `dired-copy-filename-as-kill'
@ 2015-09-28 13:28 Tino Calancha
[not found] ` <handler.21578.B.144344675925971.ack@debbugs.gnu.org>
2019-06-25 15:23 ` bug#21578: `ibuffer-copy-filename-as-kill' unconsistent with `dired-copy-filename-as-kill' Lars Ingebrigtsen
0 siblings, 2 replies; 5+ messages in thread
From: Tino Calancha @ 2015-09-28 13:28 UTC (permalink / raw)
To: 21578
[-- Attachment #1: Type: text/plain, Size: 522 bytes --]
This is not a bug, its a suggestion.
It would be pleasant if these two functions would behave similarly
whenever we dont have marked files: the later one returns filename for
next ARG files (or file in the current line if ARG nil), which i found useful.
The former one report an error and exists.
I found better if `ibuffer-copy-filename-as-kill' behaves as the
dired function in that situation.
Attached two patches:
*) one over emacs-v24.5 ibuf-ext.el
*) another including patches from bug reports #21576, #21577.
[-- Attachment #2: Type: text/plain, Size: 3200 bytes --]
*** ibuf-ext.el 2015-09-28 22:18:45.368651818 +0900
--- ibuf-ext_patch3.el 2015-09-28 22:18:45.411651819 +0900
***************
*** 1387,1393 ****
;;;###autoload
(defun ibuffer-copy-filename-as-kill (&optional arg)
! "Copy filenames of marked buffers into the kill ring.
The names are separated by a space.
If a buffer has no filename, it is ignored.
--- 1387,1393 ----
;;;###autoload
(defun ibuffer-copy-filename-as-kill (&optional arg)
! "Copy filenames of marked buffers (or next ARG) into the kill ring.
The names are separated by a space.
If a buffer has no filename, it is ignored.
***************
*** 1399,1431 ****
You can then feed the file name(s) to other commands with \\[yank]."
(interactive "p")
! (if (zerop (ibuffer-count-marked-lines))
! (message "No buffers marked; use 'm' to mark a buffer")
! (let ((ibuffer-copy-filename-as-kill-result "")
! (type (cond ((zerop arg)
! 'full)
! ((= arg 4)
! 'relative)
! (t
! 'name))))
! (ibuffer-map-marked-lines
! #'(lambda (buf _mark)
! (setq ibuffer-copy-filename-as-kill-result
! (concat ibuffer-copy-filename-as-kill-result
! (let ((name (buffer-file-name buf)))
! (if name
! (pcase type
! (`full
! name)
! (`relative
! (file-relative-name
! name (or ibuffer-default-directory
! default-directory)))
! (_
! (file-name-nondirectory name)))
! ""))
! " "))))
! (kill-new ibuffer-copy-filename-as-kill-result))))
(defun ibuffer-mark-on-buffer (func &optional ibuffer-mark-on-buffer-mark group)
(let ((count
--- 1399,1438 ----
You can then feed the file name(s) to other commands with \\[yank]."
(interactive "p")
! (let ((ibuffer-copy-filename-as-kill-result "")
! (type (cond ((zerop arg)
! 'full)
! ((= arg 4)
! 'relative)
! (t
! 'name)))
! (undo-marks))
! (when (zerop (ibuffer-count-marked-lines))
! (let ((nmarks
! (cond ((or (null arg) (zerop arg)) 1)
! ((integerp arg) arg)
! (t 1))))
! (save-excursion (ibuffer-mark-forward nmarks))
! (setq undo-marks t)))
! (ibuffer-map-marked-lines
! #'(lambda (buf _mark)
! (setq ibuffer-copy-filename-as-kill-result
! (concat ibuffer-copy-filename-as-kill-result
! (let ((name (buffer-file-name buf)))
! (if name
! (pcase type
! (`full
! name)
! (`relative
! (file-relative-name
! name (or ibuffer-default-directory
! default-directory)))
! (_
! (file-name-nondirectory name)))
! ""))
! " "))))
! (when undo-marks (ibuffer-unmark-all ?>))
! (kill-new ibuffer-copy-filename-as-kill-result)))
(defun ibuffer-mark-on-buffer (func &optional ibuffer-mark-on-buffer-mark group)
(let ((count
[-- Attachment #3: Type: text/plain, Size: 3730 bytes --]
*** ibuf-ext.el 2015-09-28 22:19:31.243651814 +0900
--- ibuf-ext_patch4.el 2015-09-28 22:19:31.320651814 +0900
***************
*** 1387,1393 ****
;;;###autoload
(defun ibuffer-copy-filename-as-kill (&optional arg)
! "Copy filenames of marked buffers into the kill ring.
The names are separated by a space.
If a buffer has no filename, it is ignored.
--- 1387,1393 ----
;;;###autoload
(defun ibuffer-copy-filename-as-kill (&optional arg)
! "Copy filenames of marked buffers (or next ARG) into the kill ring.
The names are separated by a space.
If a buffer has no filename, it is ignored.
***************
*** 1399,1431 ****
You can then feed the file name(s) to other commands with \\[yank]."
(interactive "p")
! (if (zerop (ibuffer-count-marked-lines))
! (message "No buffers marked; use 'm' to mark a buffer")
! (let ((ibuffer-copy-filename-as-kill-result "")
! (type (cond ((zerop arg)
! 'full)
! ((= arg 4)
! 'relative)
! (t
! 'name))))
! (ibuffer-map-marked-lines
! #'(lambda (buf _mark)
! (setq ibuffer-copy-filename-as-kill-result
! (concat ibuffer-copy-filename-as-kill-result
! (let ((name (buffer-file-name buf)))
! (if name
! (pcase type
! (`full
! name)
! (`relative
! (file-relative-name
! name (or ibuffer-default-directory
! default-directory)))
! (_
! (file-name-nondirectory name)))
! ""))
! " "))))
! (kill-new ibuffer-copy-filename-as-kill-result))))
(defun ibuffer-mark-on-buffer (func &optional ibuffer-mark-on-buffer-mark group)
(let ((count
--- 1399,1441 ----
You can then feed the file name(s) to other commands with \\[yank]."
(interactive "p")
! (let ((ibuffer-copy-filename-as-kill-result "")
! (type (cond ((or (null arg) (zerop arg))
! 'full)
! ((= arg 4)
! 'relative)
! (t
! 'name)))
! (undo-marks))
! (when (zerop (ibuffer-count-marked-lines))
! (let ((nmarks
! (cond ((or (null arg) (zerop arg)) 1)
! ((integerp arg) arg)
! (t 1))))
! (save-excursion (ibuffer-mark-forward nmarks))
! (setq undo-marks t)))
! (ibuffer-map-marked-lines
! #'(lambda (buf _mark)
! (setq ibuffer-copy-filename-as-kill-result
! (concat ibuffer-copy-filename-as-kill-result
! (let ((name (buffer-file-name buf)))
! (cond (name
! (concat
! (pcase type
! (`full
! name)
! (`relative
! (file-relative-name
! name (or ibuffer-default-directory
! default-directory)))
! (_
! (file-name-nondirectory name))) " "))
! (t "")))))))
! (when (not (zerop (length ibuffer-copy-filename-as-kill-result)))
! (setq ibuffer-copy-filename-as-kill-result
! (substring ibuffer-copy-filename-as-kill-result 0 -1)))
! (when undo-marks (ibuffer-unmark-all ?>))
! (kill-new ibuffer-copy-filename-as-kill-result)))
(defun ibuffer-mark-on-buffer (func &optional ibuffer-mark-on-buffer-mark group)
(let ((count
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#21578: 24.5; `ibuffer-copy-filename-as-kill' unconsistent with `dired-copy-filename-as-kill'
[not found] ` <handler.21578.B.144344675925971.ack@debbugs.gnu.org>
@ 2015-10-02 11:46 ` Tino Calancha
2015-10-04 14:15 ` bug#21578: `ibuffer-copy-buffername-as-kill' Tino Calancha
1 sibling, 0 replies; 5+ messages in thread
From: Tino Calancha @ 2015-10-02 11:46 UTC (permalink / raw)
To: 21578
dired-copy-filename-as-kill doesnt make distinction between dir/files.
Considering that these functions names just differ in the prefix,
and the documentation strings looks almost the same,
consistenty reasons demand that they behave almost the same:
ibuffer-copy-filename-as-kill should return the (dired-default-directory)
for those buffers in dired mode.
It would be also natural (but maybe not very useful) if
ibuffer-copy-filename-as-kill behaves as its dired partner when we
have marked buffers but we pass a numerical argument !=0: my patches didnt
took this in account.
By the way, my patch3 should replace:
?>
with
ibuffer-marked-char
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#21578: `ibuffer-copy-buffername-as-kill'
[not found] ` <handler.21578.B.144344675925971.ack@debbugs.gnu.org>
2015-10-02 11:46 ` bug#21578: 24.5; " Tino Calancha
@ 2015-10-04 14:15 ` Tino Calancha
1 sibling, 0 replies; 5+ messages in thread
From: Tino Calancha @ 2015-10-04 14:15 UTC (permalink / raw)
To: 21578
I also miss a function like:
ibuffer-copy-buffername-as-kill
Sometimes you want the buffer name at the current line regardless
of whether this buffer is visiting a file or not.
I would like this function behave similarly as
ibuffer-copy-filename-as-kill concerning with if we have marked buffers
or not.
In principle, such function could be bind to "B".
In my case i bind it to "b" (re-binding `ibuffer-bury-buffer'
to "B", because i rarely use this function).
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#21578: `ibuffer-copy-filename-as-kill' unconsistent with `dired-copy-filename-as-kill'
2015-09-28 13:28 bug#21578: `ibuffer-copy-filename-as-kill' unconsistent with `dired-copy-filename-as-kill' Tino Calancha
[not found] ` <handler.21578.B.144344675925971.ack@debbugs.gnu.org>
@ 2019-06-25 15:23 ` Lars Ingebrigtsen
2020-08-12 12:43 ` Lars Ingebrigtsen
1 sibling, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-25 15:23 UTC (permalink / raw)
To: Tino Calancha; +Cc: 21578
Tino Calancha <f92capac@gmail.com> writes:
> This is not a bug, its a suggestion.
>
> It would be pleasant if these two functions would behave similarly
> whenever we dont have marked files: the later one returns filename for
> next ARG files (or file in the current line if ARG nil), which i found
> useful.
> The former one report an error and exists.
>
> I found better if `ibuffer-copy-filename-as-kill' behaves as the dired
> function in that situation.
That does makes sense to me. The patch no longer applies, though --
would it be possible to redo it now?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#21578: `ibuffer-copy-filename-as-kill' unconsistent with `dired-copy-filename-as-kill'
2019-06-25 15:23 ` bug#21578: `ibuffer-copy-filename-as-kill' unconsistent with `dired-copy-filename-as-kill' Lars Ingebrigtsen
@ 2020-08-12 12:43 ` Lars Ingebrigtsen
0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-12 12:43 UTC (permalink / raw)
To: Tino Calancha; +Cc: 21578
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Tino Calancha <f92capac@gmail.com> writes:
>
>> This is not a bug, its a suggestion.
>>
>> It would be pleasant if these two functions would behave similarly
>> whenever we dont have marked files: the later one returns filename for
>> next ARG files (or file in the current line if ARG nil), which i found
>> useful.
>> The former one report an error and exists.
>>
>> I found better if `ibuffer-copy-filename-as-kill' behaves as the dired
>> function in that situation.
>
> That does makes sense to me. The patch no longer applies, though --
> would it be possible to redo it now?
Oh, looking at this again, it seems like this was already applied (in
2016), so I'm closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-12 12:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-28 13:28 bug#21578: `ibuffer-copy-filename-as-kill' unconsistent with `dired-copy-filename-as-kill' Tino Calancha
[not found] ` <handler.21578.B.144344675925971.ack@debbugs.gnu.org>
2015-10-02 11:46 ` bug#21578: 24.5; " Tino Calancha
2015-10-04 14:15 ` bug#21578: `ibuffer-copy-buffername-as-kill' Tino Calancha
2019-06-25 15:23 ` bug#21578: `ibuffer-copy-filename-as-kill' unconsistent with `dired-copy-filename-as-kill' Lars Ingebrigtsen
2020-08-12 12:43 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).