From: Tino Calancha <f92capac@gmail.com>
To: 23781@debbugs.gnu.org
Subject: bug#23781: 25.0.95; read-string with HIST lexically bound
Date: Fri, 17 Jun 2016 14:19:02 +0900 [thread overview]
Message-ID: <6bd7ad5e-7319-5f07-4612-26cda5621291@gmail.com> (raw)
Hello,
recently i have noticed that arg HIST in read-from-minibuffer/read-string
needs to be dynamically bound. If the file has the local variable
lexical-binding non-nil those functions just pick up one element of HIST.
In case this is a feature, it would be worth to mention it on the manual.
Following example reproduce the issue:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
I)
Create two files 'test-dynamic.el', 'test-lexical.el'
as follows:
*) test-dynamic.el:
(defun my-test-dynamic ()
"Test of dynamic-binding."
(interactive)
(let ((values '("a" "b" "c")))
(read-string "dynamic: " (car values) '(values . 1))))
*) test-lexical.el:
;; -*- lexical-binding: t; -*-
(defvar my-test-var nil)
(defun my-test-lexical-defvar ()
"Test of lexical-binding with defvar."
(interactive)
(let ((values '("a" "b" "c")))
(setq my-test-var values))
(read-string "lexical-defvar: " (car my-test-var) '(my-test-var . 1)))
(defun my-test-lexical ()
"Test of lexical-binding."
(interactive)
(let ((values '("a" "b" "c")))
(read-string "lexical: " (car values) '(values . 1))))
II)
emacs -Q -l test-dynamic.el -l test-lexical.el
II.1)
M-x my-test-dynamic RET
;; minibuffer shows: dynamic: a
M-p
;; minibuffer shows: dynamic: b
M-p
;; minibuffer shows: dynamic: c
II.2) (Similar than II.1)
M-x my-test-lexical-defvar RET
;; minibuffer shows: lexical-defvar: a
M-p
;; minibuffer shows: lexical-defvar: b
M-p
;; minibuffer shows: lexical-defvar: c
II.3) (Different)
M-x my-test-lexical RET
;; minibuffer shows: lexical: a
M-p
;; user-error: Beginning of history; no preceding item
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 25.0.95.1 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6)
of 2016-06-15 built on calancha-pc
Repository revision: d7084f2260943287cdfb5e3021ac33aab6a14c6d
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description: Debian GNU/Linux testing (stretch)
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11
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
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit [2 times]
user-error: Beginning of history; no preceding item [2 times]
Quit
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr mail-utils time-date 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 move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)
Memory information:
((conses 16 86343 6478)
(symbols 48 19751 0)
(miscs 40 38 121)
(strings 32 14375 4876)
(string-bytes 1 409631)
(vectors 16 11718)
(vector-slots 8 428578 4129)
(floats 8 164 84)
(intervals 56 193 0)
(buffers 976 11)
(heap 1024 28246 991))
next reply other threads:[~2016-06-17 5:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-17 5:19 Tino Calancha [this message]
2016-06-17 15:25 ` bug#23781: 25.0.95; read-string with HIST lexically bound Michael Heerdegen
2016-06-23 23:01 ` Noam Postavsky
2016-06-23 23:18 ` Drew Adams
2016-06-25 0:26 ` Noam Postavsky
2016-06-25 10:12 ` Stephen Berman
2016-06-25 16:53 ` Noam Postavsky
2016-06-25 18:53 ` Stephen Berman
2016-06-25 19:46 ` Noam Postavsky
2016-06-25 22:07 ` Stephen Berman
2016-06-25 23:42 ` Michael Heerdegen
2016-06-26 3:34 ` Noam Postavsky
2016-06-27 0:55 ` Noam Postavsky
2016-07-01 4:07 ` npostavs
2016-06-26 2:23 ` Drew Adams
2016-06-25 21:00 ` Drew Adams
2016-06-25 20:42 ` Drew Adams
2016-06-24 2:24 ` Tino Calancha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6bd7ad5e-7319-5f07-4612-26cda5621291@gmail.com \
--to=f92capac@gmail.com \
--cc=23781@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.