From: rolf@pointsman.de
To: 23566@debbugs.gnu.org
Subject: bug#23566: 25.0.94; sql-sqlite: selecting database file is crippled
Date: Tue, 17 May 2016 22:02:49 +0200 [thread overview]
Message-ID: <87posko3km.fsf@linux-qg7d.i-did-not-set--mail-host-address--so-tickle-me> (raw)
The problem is in 24.5.1 as well as in current 25.1 branch. (Note: you
don't need to use sqlite or have it (and a database file) on your disk,
to see the problem.)
To reproduce:
- Start emacs -Q
- M-x sql-sqlite
This prompts the user to specify a sqlite database file in the
minibuffer.
Lets assume, you have a sqlite database file in /var/tmp (you don't
actually have to, that's just a path that is assumed to exist at least
on a lot of unix systems).
Try to navigate there in the minibuffer prompt: Remove everthing and
start typing /v, then <Tab> for completion. The prompt doesn't complete
nor provides multiple alternatives, if what you have already typed isn't
unambiguous. You have to spell out (mean: type in) every character of
the path.
(Note: This is only one simple way, to stumble about the problem. It
raises its head also, if you put a buffer in sql-mode, select product
"sqlite" and open a sqli buffer (C-c Tab))
This problem has his roots in the combination of the default value of
the variable sql-sqlite-login-params (which itself is debatable, but
this is not the main point of this bug report) and the implementation of
sql-get-login-ext, which is called behind the scene, as part of the
implementation of sql-sqlite.
The default value of sql-sqlite-login-params is:
((database :file ".*\\.\\(db\\|sqlite[23]?\\)"))
The crucial part of sql-get-login-ext for this bug report is:
(cond
((plist-member plist :file)
(expand-file-name
(read-file-name prompt
(file-name-directory last-value) default t
(file-name-nondirectory last-value)
(when (plist-get plist :file)
`(lambda (f)
(string-match
(concat "\\<" ,(plist-get plist :file) "\\>")
(file-name-nondirectory f)))))))
<more conditions follow>
Look at the params of the used read-file-name. Since there is a :file
property in the sql-sqlite-login-params default value, the
read-file-name has a PREDICATE argument, the lambda function
`(lambda (f)
(string-match
(concat "\\<" ,(plist-get plist :file) "\\>")
(file-name-nondirectory f)))))))
read-file-name will call this function for every completion candidate
(thats the f argument). The function will return nil for almost all
directory names and most file names (all, that doesn't end in
.db|.sqlite2|.sqlite3), which means they are ruled out as possible
completion candiates. Therefor, tab completion of a sub path doesn't
work, as shown above.
If ever, that cond condition should look like:
((plist-member plist :file)
(expand-file-name
(read-file-name prompt
(file-name-directory last-value) default t
(file-name-nondirectory last-value)
(when (plist-get plist :file)
`(lambda (f)
(if (not(file-regular-p))
t
(string-match
(concat "\\<" ,(plist-get plist :file) "\\>")
(file-name-nondirectory f))))))))
Note the modification in the lambda function: check for the file name
pattern only, if the completion candidate is a regular file. Everything
else - especially directory names - are valid completion candidates.
In GNU Emacs 25.0.94.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
of 2016-05-17 built on linux-qg7d
Repository revision: a35826dbd44122b97e93d0c67bf658ced0a07ec6
Windowing system distributor 'The X.Org Foundation', version 11.0.11203000
System Description: openSUSE 12.2 (x86_64)
Configured using:
'configure --with-modules'
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES
Important settings:
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=local
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.
Making completion list...
Quit
Making completion list... [2 times]
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 mail-prsvr
mail-utils sql easymenu view thingatpt comint ansi-color ring
cl-loaddefs pcase cl-lib 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 93084 4930)
(symbols 48 20431 0)
(miscs 40 39 121)
(strings 32 16670 4379)
(string-bytes 1 518027)
(vectors 16 12706)
(vector-slots 8 436890 4797)
(floats 8 171 172)
(intervals 56 207 0)
(buffers 976 12)
(heap 1024 22938 671))
next reply other threads:[~2016-05-17 20:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 20:02 rolf [this message]
[not found] ` <handler.23566.B.146353563826367.ack@debbugs.gnu.org>
2016-05-18 12:50 ` bug#23566: Acknowledgement (25.0.94; sql-sqlite: selecting database file is crippled) Rolf Ade
2016-07-20 23:11 ` bug#23566: " Rolf Ade
2017-01-01 3:13 ` Rolf Ade
2017-01-01 4:03 ` npostavs
2017-01-03 0:19 ` Rolf Ade
2017-01-03 23:42 ` Rolf Ade
2017-01-07 17:01 ` npostavs
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=87posko3km.fsf@linux-qg7d.i-did-not-set--mail-host-address--so-tickle-me \
--to=rolf@pointsman.de \
--cc=23566@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.