unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26939: 25.2; emacs --daemon, incorrect icomplete-prospects-height
@ 2017-05-15 13:10 Frank Haun
  2017-06-05 23:19 ` npostavs
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Haun @ 2017-05-15 13:10 UTC (permalink / raw)
  To: 26939


Hi,

There is a wrong calculation of `icomplete-prospects-height` when Emacs
starts as daemon and icomplete is enabled via the init file.

Emacs daemon returns 10 for `window-width` and
`icomplete-prospects-height` becomes 11.



In GNU Emacs 25.2.1 (armv7l-unknown-linux-gnueabihf, X toolkit, Xaw3d scroll bars)
 of 2017-04-21 built on m8000
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
System Description:	Arch Linux

Configured using:
 'configure --prefix=/home/fhaun/opt/emacs-master --without-imagemagick
 --with-xft --with-x-toolkit=lucid'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GCONF GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
LUCID X11

Important settings:
  value of $LC_NUMERIC: de_DE.utf8
  value of $LC_TIME: de_DE.utf8
  value of $LANG: en_GB.utf8
  locale-coding-system: utf-8-unix

Major mode: λ

Minor modes in effect:
  icomplete-mode: t
  winner-mode: t
  shell-dirtrack-mode: t
  eyebrowse-mode: t
  shackle-mode: t
  flx-ido-mode: t
  ido-grid-mode: t
  ido-vertical-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  autopair-global-mode: t
  autopair-mode: t
  show-paren-mode: t
  global-evil-surround-mode: t
  evil-surround-mode: t
  evil-snipe-override-mode: t
  evil-snipe-mode: t
  evil-snipe-override-local-mode: t
  evil-snipe-local-mode: t
  evil-leader-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  evil-mode: t
  evil-local-mode: t
  override-global-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
evil-line-move: End of buffer
Mark set
Type C-w C-o to delete the help window.
2 (#o2, #x2, ?\C-b)
11 (#o13, #xb, ?\C-k)
Creating customization items...
Creating customization items ...done
Resetting customization items...done
Creating customization setup...done
Quit

Load-path shadows:
/home/fhaun/.emacs.d/elpa/seq-2.20/seq hides /home/fhaun/opt/emacs-master/share/emacs/25.2/lisp/emacs-lisp/seq

Features:
(shadow sort mail-extr emacsbug message dired rfc822 mml mml-sec epg
mm-decode mailabbrev gmm-utils mailheader sendmail mail-utils jka-compr
find-func cus-edit wid-edit cus-start cus-load icomplete misearch
multi-isearch ffap url-parse url-vars server two-column winner generic-x
ibuf-ext ibuffer smart-mode-line rich-minority mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums tramp tramp-compat
auth-source eieio eieio-core gnus-util time-date mm-util help-fns
mail-prsvr password-cache tramp-loaddefs trampver ucs-normalize shell
pcomplete comint ansi-color cl-macs eyebrowse format-spec dash shackle
flx-ido flx ido-grid-mode ido-vertical-mode ido .emacs-packs go-snippets
yasnippet cl-seq autopair paren highlight-symbol iedit iedit-lib company
evil-surround evil-snipe evil-leader evil evil-integration undo-tree
diff evil-maps evil-commands evil-jumps evil-command-window evil-types
evil-search evil-ex evil-macros evil-repeat evil-states evil-core advice
evil-common windmove thingatpt rect evil-digraphs evil-vars ring edmacro
kmacro use-package diminish bind-key easy-mmode finder-inf info package
epg-config seq byte-opt gv bytecomp byte-compile cl-extra help-mode
easymenu cconv cl-loaddefs pcase cl-lib mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core 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 charscript case-table epa-hook jka-cmpr-hook help
simple abbrev 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
dbusbind inotify dynamic-setting system-font-setting font-render-setting
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 8 396118 49940)
 (symbols 24 35634 0)
 (miscs 20 272 460)
 (strings 16 69701 12829)
 (string-bytes 1 2069926)
 (vectors 8 53708)
 (vector-slots 4 1023547 7442)
 (floats 8 734 58)
 (intervals 28 706 669)
 (buffers 520 25))





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

* bug#26939: 25.2; emacs --daemon, incorrect icomplete-prospects-height
  2017-05-15 13:10 bug#26939: 25.2; emacs --daemon, incorrect icomplete-prospects-height Frank Haun
@ 2017-06-05 23:19 ` npostavs
  2017-06-06  2:37   ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: npostavs @ 2017-06-05 23:19 UTC (permalink / raw)
  To: Frank Haun; +Cc: 26939

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

tags 26939 patch
quit

Frank Haun <fh@fhaun.de> writes:

> There is a wrong calculation of `icomplete-prospects-height` when Emacs
> starts as daemon and icomplete is enabled via the init file.
>
> Emacs daemon returns 10 for `window-width` and
> `icomplete-prospects-height` becomes 11.

This is a bit similar to #27210, window sizes are unreliable in daemon
mode.  I think putting (window-width) as the standard value doesn't make
sense anyway.  The code that uses this variable already add the
window-width:

              ;; Max total length to use, including the minibuffer content.
              (* (+ icomplete-prospects-height
                    ;; If the minibuffer content already uses up more than
                    ;; one line, increase the allowable space accordingly.
                    (/ prospects-len (window-width)))
                 (window-width))

So I think we should just change the standard value to 2 (which would
currently be the default for window-width of 80).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1136 bytes --]

From ca5812c7f5fd222db48aa7f43986ae6240e3640a Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Mon, 5 Jun 2017 19:18:14 -0400
Subject: [PATCH v1] * lisp/icomplete.el (icomplete-prospects-height): Default
 to 2 (Bug#26939).

---
 lisp/icomplete.el | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index cd352de65b..00f8ed18a1 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -91,13 +91,10 @@ (defface icomplete-first-match '((t :weight bold))
   :version "24.4")
 
 ;;;_* User Customization variables
-(defcustom icomplete-prospects-height
-  ;; 20 is an estimated common size for the prompt + minibuffer content, to
-  ;; try to guess the number of lines used up by icomplete-prospects-length.
-  (+ 1 (/ (+ icomplete-prospects-length 20) (window-width)))
+(defcustom icomplete-prospects-height 2
   "Maximum number of lines to use in the minibuffer."
   :type 'integer
-  :version "23.1")
+  :version "26.1")
 
 (defcustom icomplete-compute-delay .3
   "Completions-computation stall, used only with large-number completions.
-- 
2.11.1


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

* bug#26939: 25.2; emacs --daemon, incorrect icomplete-prospects-height
  2017-06-05 23:19 ` npostavs
@ 2017-06-06  2:37   ` Eli Zaretskii
  2017-06-06 12:33     ` npostavs
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2017-06-06  2:37 UTC (permalink / raw)
  To: npostavs; +Cc: fh, 26939

> From: npostavs@users.sourceforge.net
> Date: Mon, 05 Jun 2017 19:19:47 -0400
> Cc: 26939@debbugs.gnu.org
> 
>               ;; Max total length to use, including the minibuffer content.
>               (* (+ icomplete-prospects-height
>                     ;; If the minibuffer content already uses up more than
>                     ;; one line, increase the allowable space accordingly.
>                     (/ prospects-len (window-width)))
>                  (window-width))
> 
> So I think we should just change the standard value to 2 (which would
> currently be the default for window-width of 80).

I suggest a comment there explaining the value.

Thanks.





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

* bug#26939: 25.2; emacs --daemon, incorrect icomplete-prospects-height
  2017-06-06  2:37   ` Eli Zaretskii
@ 2017-06-06 12:33     ` npostavs
  2017-06-14 11:04       ` npostavs
  0 siblings, 1 reply; 5+ messages in thread
From: npostavs @ 2017-06-06 12:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: fh, 26939

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

Eli Zaretskii <eliz@gnu.org> writes:

> I suggest a comment there explaining the value.

Good point.  I also noticed that this default value was the last use of
icomplete-prospects-length which is marked obsolete since 23.1, so I've
completely removed its definition too.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2542 bytes --]

From 382fb609e1d72f802b0dbff07ed461cfc34261ff Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Mon, 5 Jun 2017 19:18:14 -0400
Subject: [PATCH v2] Give a fixed default value for icomplete-prospects-height
 (Bug#26939)

* lisp/icomplete.el (icomplete-prospects-height): Default to 2.
(icomplete-prospects-length): Remove.
* etc/NEWS: Announce removal.
---
 etc/NEWS          |  1 +
 lisp/icomplete.el | 15 ++++++---------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index cbd388b216..7cc773d5e0 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -926,6 +926,7 @@ of not providing replacement pairs via the history.
 *** make-variable-frame-local.  Variables cannot be frame-local any more.
 *** From subr.el: window-dot, set-window-dot, read-input, show-buffer,
 eval-current-buffer, string-to-int
+*** icomplete-prospects-length.
 *** All the default-FOO variables that hold the default value of the
 FOO variable.  Use 'default-value' and 'setq-default' to access and
 change FOO, respectively.  The exhaustive list of removed variables is:
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index cd352de65b..a4153e806d 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -56,10 +56,6 @@ (defgroup icomplete nil
   :link '(info-link "(emacs)Icomplete")
   :group 'minibuffer)
 
-(defvar icomplete-prospects-length 80)
-(make-obsolete-variable
- 'icomplete-prospects-length 'icomplete-prospects-height "23.1")
-
 (defcustom icomplete-separator " | "
   "String used by Icomplete to separate alternatives in the minibuffer."
   :type 'string
@@ -91,13 +87,14 @@ (defface icomplete-first-match '((t :weight bold))
   :version "24.4")
 
 ;;;_* User Customization variables
-(defcustom icomplete-prospects-height
-  ;; 20 is an estimated common size for the prompt + minibuffer content, to
-  ;; try to guess the number of lines used up by icomplete-prospects-length.
-  (+ 1 (/ (+ icomplete-prospects-length 20) (window-width)))
+(defcustom icomplete-prospects-height 2
+  ;; We used to compute how many lines 100 characters would take in
+  ;; the current window width, but the return value of `window-width'
+  ;; is unreliable on startup (e.g., if we're in daemon mode), so now
+  ;; we simply base the default value on an 80 column window.
   "Maximum number of lines to use in the minibuffer."
   :type 'integer
-  :version "23.1")
+  :version "26.1")
 
 (defcustom icomplete-compute-delay .3
   "Completions-computation stall, used only with large-number completions.
-- 
2.11.1


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

* bug#26939: 25.2; emacs --daemon, incorrect icomplete-prospects-height
  2017-06-06 12:33     ` npostavs
@ 2017-06-14 11:04       ` npostavs
  0 siblings, 0 replies; 5+ messages in thread
From: npostavs @ 2017-06-14 11:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: fh, 26939

tags 26939 fixed
close 26939 26.1
quit

npostavs@users.sourceforge.net writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> I suggest a comment there explaining the value.
>
> Good point.  I also noticed that this default value was the last use of
> icomplete-prospects-length which is marked obsolete since 23.1, so I've
> completely removed its definition too.

Pushed to master [1: 5647c4a2c6].

[1: 5647c4a2c6]: 2017-06-14 07:03:05 -0400
  Give a fixed default value for icomplete-prospects-height (Bug#26939)
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5647c4a2c62054ad3dae3d6d83739b7cc4d10c9f





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

end of thread, other threads:[~2017-06-14 11:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15 13:10 bug#26939: 25.2; emacs --daemon, incorrect icomplete-prospects-height Frank Haun
2017-06-05 23:19 ` npostavs
2017-06-06  2:37   ` Eli Zaretskii
2017-06-06 12:33     ` npostavs
2017-06-14 11:04       ` npostavs

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).