unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d
@ 2017-04-04 12:20 Philipp Stephani
  2017-04-04 12:28 ` Noam Postavsky
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Philipp Stephani @ 2017-04-04 12:20 UTC (permalink / raw)
  To: 26360


M-x ido-mode

Then try
C-x C-f
C-x d
C-x 4 f
C-x 4 d

In the first three cases, IDO will be used, but not in the fourth case.
That's a weird inconsistency.


In GNU Emacs 26.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.10.8)
 of 2017-04-04 built on unknown
Repository revision: f4b50dad8d5eade04f495c693c0bca46060b25cb
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description:	Ubuntu 14.04 LTS

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --without-pop --with-mailutils --enable-checking
 --enable-check-lisp-object-type --with-modules 'CFLAGS=-O0 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY GNUTLS FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message puny seq byte-opt subr-x gv
bytecomp byte-compile cl-extra help-mode cconv cl-loaddefs pcase cl-lib
dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript case-table epa-hook jka-cmpr-hook help
simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote inotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 95798 11364)
 (symbols 48 20179 1)
 (miscs 40 39 156)
 (strings 32 17662 4751)
 (string-bytes 1 576290)
 (vectors 16 14098)
 (vector-slots 8 483725 5397)
 (floats 8 48 68)
 (intervals 56 217 0)
 (buffers 976 12)
 (heap 1024 23372 1029))

-- 
Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle

Diese E-Mail ist vertraulich.  Wenn Sie nicht der richtige Adressat sind,
leiten Sie diese bitte nicht weiter, informieren Sie den Absender und löschen
Sie die E-Mail und alle Anhänge.  Vielen Dank.

This e-mail is confidential.  If you are not the right addressee please do not
forward it, please inform the sender, and please erase this e-mail including
any attachments.  Thanks.





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

* bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d
  2017-04-04 12:20 bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d Philipp Stephani
@ 2017-04-04 12:28 ` Noam Postavsky
  2017-04-20 13:45 ` Philipp Stephani
  2022-02-10  8:01 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 8+ messages in thread
From: Noam Postavsky @ 2017-04-04 12:28 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: 26360

On Tue, Apr 4, 2017 at 8:20 AM, Philipp Stephani <p.stephani2@gmail.com> wrote:
>
> M-x ido-mode
>
> Then try
> C-x C-f
> C-x d
> C-x 4 f
> C-x 4 d
>
> In the first three cases, IDO will be used, but not in the fourth case.
> That's a weird inconsistency.

Doing M-x ido-everywhere makes it consistent. Not sure if this is on
purpose or not...





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

* bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d
  2017-04-04 12:20 bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d Philipp Stephani
  2017-04-04 12:28 ` Noam Postavsky
@ 2017-04-20 13:45 ` Philipp Stephani
  2017-04-21  3:29   ` npostavs
  2022-02-10  8:01 ` Lars Ingebrigtsen
  2 siblings, 1 reply; 8+ messages in thread
From: Philipp Stephani @ 2017-04-20 13:45 UTC (permalink / raw)
  To: 26360


[-- Attachment #1.1: Type: text/plain, Size: 325 bytes --]

Philipp Stephani <p.stephani2@gmail.com> schrieb am Di., 4. Apr. 2017 um
14:22 Uhr:

>
> M-x ido-mode
>
> Then try
> C-x C-f
> C-x d
> C-x 4 f
> C-x 4 d
>
> In the first three cases, IDO will be used, but not in the fourth case.
> That's a weird inconsistency.
>
>
Here's a patch (which includes a couple of other commands).

[-- Attachment #1.2: Type: text/html, Size: 659 bytes --]

[-- Attachment #2: 0001-Add-missing-remappings-for-Ido-mode.txt --]
[-- Type: text/plain, Size: 8229 bytes --]

From 0a5cb56a55fea6668e50822f37fe90c2cebc4441 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Thu, 20 Apr 2017 15:41:15 +0200
Subject: [PATCH] Add missing remappings for Ido mode

Among others, add a remapping for C-x 4 d, cf. Bug#26360.

* lisp/ido.el (ido-mode): Remap missing commands.
(ido-file-internal, ido-visit-buffer): Add support for new
methods.
(ido-display-buffer-other-frame)
(ido-find-alternate-file-other-window, ido-dired-other-window)
(ido-dired-other-frame): New commands.

* test/lisp/ido-tests.el (ido-tests--other-window-frame): Add unit
test for the bindings.
---
 etc/NEWS               |  7 ++++++
 lisp/ido.el            | 61 +++++++++++++++++++++++++++++++++++++++++++++++---
 test/lisp/ido-tests.el | 47 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 112 insertions(+), 3 deletions(-)
 create mode 100644 test/lisp/ido-tests.el

diff --git a/etc/NEWS b/etc/NEWS
index e351abc159..6d1643d2dd 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -545,6 +545,13 @@ replaced by the real images asynchronously, which will also now
 respect width/height HTML specs (unless they specify widths/heights
 bigger than the current window).
 
+** Ido
+
+*** The commands 'find-alternate-file-other-window',
+'dired-other-window', 'dired-other-frame', and
+'display-buffer-other-window' are now remapped to Ido equivalents if
+Ido mode is active.
+
 ** Images
 
 +++
diff --git a/lisp/ido.el b/lisp/ido.el
index 293c8e2857..318f2fe082 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1640,10 +1640,14 @@ ido-mode
           'ido-find-file-other-window)
 	(define-key map [remap find-file-read-only-other-window]
           'ido-find-file-read-only-other-window)
+        (define-key map [remap find-alternate-file-other-window]
+          #'ido-find-alternate-file-other-window)
+        (define-key map [remap dired-other-window] #'ido-dired-other-window)
 	(define-key map [remap find-file-other-frame]
           'ido-find-file-other-frame)
 	(define-key map [remap find-file-read-only-other-frame]
-          'ido-find-file-read-only-other-frame))
+          'ido-find-file-read-only-other-frame)
+        (define-key map [remap dired-other-frame] #'ido-dired-other-frame))
 
       (when (memq ido-mode '(buffer both))
 	(define-key map [remap switch-to-buffer] 'ido-switch-buffer)
@@ -1653,7 +1657,9 @@ ido-mode
           'ido-switch-buffer-other-frame)
 	(define-key map [remap insert-buffer] 'ido-insert-buffer)
 	(define-key map [remap kill-buffer] 'ido-kill-buffer)
-	(define-key map [remap display-buffer] 'ido-display-buffer))
+	(define-key map [remap display-buffer] 'ido-display-buffer)
+        (define-key map [remap display-buffer-other-frame]
+          #'ido-display-buffer-other-frame))
 
       (if ido-minor-mode-map-entry
 	  (setcdr ido-minor-mode-map-entry map)
@@ -2443,7 +2449,14 @@ ido-file-internal
 	(ido-record-work-directory)
 	(find-alternate-file filename))
 
-       ((memq method '(dired list-directory))
+       ((eq method 'alt-file-other-window)
+        (ido-record-work-file filename)
+        (setq default-directory ido-current-directory)
+        (ido-record-work-directory)
+        (find-alternate-file-other-window filename))
+
+       ((memq method '(dired dired-other-window dired-other-frame
+                             list-directory))
 	(if (equal filename ".")
 	    (setq filename ""))
 	(let* ((dirname (ido-final-slash
@@ -4108,6 +4121,9 @@ ido-visit-buffer
       (switch-to-buffer-other-frame buffer)
       (select-frame-set-input-focus (selected-frame)))
 
+     ((eq method 'display-other-frame)
+      (display-buffer-other-frame buffer))
+
      ((and (memq method '(raise-frame maybe-frame))
 	   window-system
 	   (setq win (ido-buffer-window-other-frame buffer))
@@ -4193,6 +4209,15 @@ ido-display-buffer
   (ido-buffer-internal 'display 'display-buffer nil nil nil 'ignore))
 
 ;;;###autoload
+(defun ido-display-buffer-other-frame ()
+  "Display a buffer preferably in another frame.
+The buffer name is selected interactively by typing a substring.
+For details of keybindings, see `ido-switch-buffer'."
+  (interactive)
+  (ido-buffer-internal 'display-other-frame #'display-buffer-other-frame
+                       nil nil nil #'ignore))
+
+;;;###autoload
 (defun ido-kill-buffer ()
   "Kill a buffer.
 The buffer name is selected interactively by typing a substring.
@@ -4291,6 +4316,14 @@ ido-find-alternate-file
   (ido-file-internal 'alt-file 'find-alternate-file nil "Find alternate file: "))
 
 ;;;###autoload
+(defun ido-find-alternate-file-other-window ()
+  "Find file as a replacement for the file in the next window.
+The file name is selected interactively by typing a substring.
+For details of keybindings, see `ido-find-file'."
+  (interactive)
+  (ido-file-internal 'alt-file-other-window #'find-alternate-file-other-window))
+
+;;;###autoload
 (defun ido-find-file-read-only ()
   "Edit file read-only with name obtained via minibuffer.
 The file name is selected interactively by typing a substring.
@@ -4364,6 +4397,28 @@ ido-dired
 	(ido-auto-merge-work-directories-length -1))
     (ido-file-internal 'dired 'dired nil "Dired: " 'dir)))
 
+;;;###autoload
+(defun ido-dired-other-window ()
+  "\"Edit\" a directory.  Like `ido-dired' but selects in another window.
+The directory is selected interactively by typing a substring.
+For details of keybindings, see `ido-find-file'."
+  (interactive)
+  (let ((ido-report-no-match nil)
+	(ido-auto-merge-work-directories-length -1))
+    (ido-file-internal 'dired-other-window #'dired-other-window nil
+                       "Dired: " 'dir)))
+
+;;;###autoload
+(defun ido-dired-other-frame ()
+  "\"Edit\" a directory.  Like `ido-dired' but makes a new frame.
+The directory is selected interactively by typing a substring.
+For details of keybindings, see `ido-find-file'."
+  (interactive)
+  (let ((ido-report-no-match nil)
+	(ido-auto-merge-work-directories-length -1))
+    (ido-file-internal 'dired-other-frame #'dired-other-frame nil
+                       "Dired: " 'dir)))
+
 (defun ido-list-directory ()
   "Call `list-directory' the Ido way.
 The directory is selected interactively by typing a substring.
diff --git a/test/lisp/ido-tests.el b/test/lisp/ido-tests.el
new file mode 100644
index 0000000000..df11096931
--- /dev/null
+++ b/test/lisp/ido-tests.el
@@ -0,0 +1,47 @@
+;;; ido-tests.el --- unit tests for ido.el           -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2017  Free Software Foundation, Inc.
+
+;; Author: Philipp Stephani <phst@google.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Unit tests for ido.el.
+
+;;; Code:
+
+(ert-deftest ido-tests--other-window-frame ()
+  "Verifies that Bug#26360 is fixed."
+  (should-not ido-mode)
+  (unwind-protect
+      (progn
+        (ido-mode)
+        (should (equal ido-mode 'both))
+        (should (equal (key-binding [remap find-alternate-file-other-window])
+                       #'ido-find-alternate-file-other-window))
+        (should (commandp #'ido-find-alternate-file-other-window))
+        (should (equal (key-binding (kbd "C-x 4 d")) #'ido-dired-other-window))
+        (should (commandp #'ido-dired-other-window))
+        (should (equal (key-binding (kbd "C-x 5 d")) #'ido-dired-other-frame))
+        (should (commandp #'ido-dired-other-frame))
+        (should (equal (key-binding (kbd "C-x 5 C-o"))
+                       #'ido-display-buffer-other-frame))
+        (should (commandp #'ido-display-buffer-other-frame)))
+    (ido-mode 0)))
+
+;;; ido-tests.el ends here
-- 
2.12.2


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

* bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d
  2017-04-20 13:45 ` Philipp Stephani
@ 2017-04-21  3:29   ` npostavs
  2017-04-22 19:24     ` Philipp Stephani
  0 siblings, 1 reply; 8+ messages in thread
From: npostavs @ 2017-04-21  3:29 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: 26360

tags 26360 patch
quit

Philipp Stephani <p.stephani2@gmail.com> writes:
>
> Here's a patch (which includes a couple of other commands).

Patch looks good, except the test seems redundant to me.  I don't think
it's useful to test that a command is defined, or testing that specific
keybindings have been set (i.e., no need to test again that `defun' or
`define-key' are working).  Also, it would fail if run from a
non-default emacs configuration that has changed the keybindings.





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

* bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d
  2017-04-21  3:29   ` npostavs
@ 2017-04-22 19:24     ` Philipp Stephani
  2017-04-22 21:40       ` npostavs
  0 siblings, 1 reply; 8+ messages in thread
From: Philipp Stephani @ 2017-04-22 19:24 UTC (permalink / raw)
  To: npostavs; +Cc: 26360

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

<npostavs@users.sourceforge.net> schrieb am Fr., 21. Apr. 2017 um 05:28 Uhr:

> tags 26360 patch
> quit
>
> Philipp Stephani <p.stephani2@gmail.com> writes:
> >
> > Here's a patch (which includes a couple of other commands).
>
> Patch looks good, except the test seems redundant to me.  I don't think
> it's useful to test that a command is defined, or testing that specific
> keybindings have been set (i.e., no need to test again that `defun' or
> `define-key' are working).


I've used a bit of TDD for this patch, thus the verbose test. Unfortunately
the actual functionality is very hard to test :-(


>   Also, it would fail if run from a
> non-default emacs configuration that has changed the keybindings.
>

True, but the main use of the tests is for continuous integration, where
the environment is controlled.

[-- Attachment #2: Type: text/html, Size: 1380 bytes --]

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

* bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d
  2017-04-22 19:24     ` Philipp Stephani
@ 2017-04-22 21:40       ` npostavs
  2017-04-23 16:43         ` Philipp Stephani
  0 siblings, 1 reply; 8+ messages in thread
From: npostavs @ 2017-04-22 21:40 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: 26360

Philipp Stephani <p.stephani2@gmail.com> writes:

> <npostavs@users.sourceforge.net> schrieb am Fr., 21. Apr. 2017 um 05:28 Uhr:
>>
>> Patch looks good, except the test seems redundant to me.  I don't think
>> it's useful to test that a command is defined, or testing that specific
>> keybindings have been set (i.e., no need to test again that `defun' or
>> `define-key' are working).
>
>
> I've used a bit of TDD for this patch, thus the verbose test.

I suppose my real objection is that 'make check' is already taking long
enough that it makes me reluctant to use it, so I don't really want to
see more tests of such marginal utility.  But any single test isn't
adding a significant amount of time, so I'm not going to insist.

In conclusion, feel free to push this; as far as I'm concerned, the
decision about the test is up to you.





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

* bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d
  2017-04-22 21:40       ` npostavs
@ 2017-04-23 16:43         ` Philipp Stephani
  0 siblings, 0 replies; 8+ messages in thread
From: Philipp Stephani @ 2017-04-23 16:43 UTC (permalink / raw)
  To: npostavs; +Cc: 26360-done

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

<npostavs@users.sourceforge.net> schrieb am Sa., 22. Apr. 2017 um 23:38 Uhr:

> Philipp Stephani <p.stephani2@gmail.com> writes:
>
> > <npostavs@users.sourceforge.net> schrieb am Fr., 21. Apr. 2017 um 05:28
> Uhr:
> >>
> >> Patch looks good, except the test seems redundant to me.  I don't think
> >> it's useful to test that a command is defined, or testing that specific
> >> keybindings have been set (i.e., no need to test again that `defun' or
> >> `define-key' are working).
> >
> >
> > I've used a bit of TDD for this patch, thus the verbose test.
>
> I suppose my real objection is that 'make check' is already taking long
> enough that it makes me reluctant to use it, so I don't really want to
> see more tests of such marginal utility.  But any single test isn't
> adding a significant amount of time, so I'm not going to insist.
>

Agreed that it takes very long, but I think good coverage is more important
(and the full suite should mostly be run on continuous integration, not
manually).


>
> In conclusion, feel free to push this; as far as I'm concerned, the
> decision about the test is up to you.
>

Thanks, pushed as a1f93c1dfa.

[-- Attachment #2: Type: text/html, Size: 1878 bytes --]

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

* bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d
  2017-04-04 12:20 bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d Philipp Stephani
  2017-04-04 12:28 ` Noam Postavsky
  2017-04-20 13:45 ` Philipp Stephani
@ 2022-02-10  8:01 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-10  8:01 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: 26360

Philipp Stephani <p.stephani2@gmail.com> writes:

> M-x ido-mode
>
> Then try
> C-x C-f
> C-x d
> C-x 4 f
> C-x 4 d
>
> In the first three cases, IDO will be used, but not in the fourth case.
> That's a weird inconsistency.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Looks like this was fixed at the time (and I can't reproduce the problem
in Emacs 29), so I'm closing this bug report now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2022-02-10  8:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-04 12:20 bug#26360: 26.0.50; ido-mode doesn't enable IDO for C-x 4 d Philipp Stephani
2017-04-04 12:28 ` Noam Postavsky
2017-04-20 13:45 ` Philipp Stephani
2017-04-21  3:29   ` npostavs
2017-04-22 19:24     ` Philipp Stephani
2017-04-22 21:40       ` npostavs
2017-04-23 16:43         ` Philipp Stephani
2022-02-10  8:01 ` 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).