* bug#23566: 25.0.94; sql-sqlite: selecting database file is crippled
@ 2016-05-17 20:02 rolf
[not found] ` <handler.23566.B.146353563826367.ack@debbugs.gnu.org>
2016-07-20 23:11 ` bug#23566: " Rolf Ade
0 siblings, 2 replies; 8+ messages in thread
From: rolf @ 2016-05-17 20:02 UTC (permalink / raw)
To: 23566
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))
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#23566: Acknowledgement (25.0.94; sql-sqlite: selecting database file is crippled)
[not found] ` <handler.23566.B.146353563826367.ack@debbugs.gnu.org>
@ 2016-05-18 12:50 ` Rolf Ade
0 siblings, 0 replies; 8+ messages in thread
From: Rolf Ade @ 2016-05-18 12:50 UTC (permalink / raw)
To: 23566
I'm sorry: I've botched my proposed change (which is not meant to be a
patch - I don't feel versed enough to judge if this is the 'right way'
to fix - but to make my point more clear). It should read as (added
the f argument to file-regular-p):
((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 f))
t
(string-match
(concat "\\<" ,(plist-get plist :file)
"\\>")
(file-name-nondirectory f))))))))
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#23566: sql-sqlite: selecting database file is crippled)
2016-05-17 20:02 bug#23566: 25.0.94; sql-sqlite: selecting database file is crippled rolf
[not found] ` <handler.23566.B.146353563826367.ack@debbugs.gnu.org>
@ 2016-07-20 23:11 ` Rolf Ade
2017-01-01 3:13 ` Rolf Ade
1 sibling, 1 reply; 8+ messages in thread
From: Rolf Ade @ 2016-07-20 23:11 UTC (permalink / raw)
To: 23566
I'm writing - I confess in the hope to rise attention to that bug - to
add emphesis to the current state. At the moment one needs a
configurateion like
(setq sql-sqlite-login-params '((database :file nil)))
for a pleasant experience with sql-sqlite.
This is low hanging fruit. Even just changing the default of
sql-sqlite-login-params to something like above would be a benefit
for most users.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#23566: sql-sqlite: selecting database file is crippled)
2016-07-20 23:11 ` bug#23566: " Rolf Ade
@ 2017-01-01 3:13 ` Rolf Ade
2017-01-01 4:03 ` npostavs
0 siblings, 1 reply; 8+ messages in thread
From: Rolf Ade @ 2017-01-01 3:13 UTC (permalink / raw)
To: 23566
Still open with GNU Emacs 26.0.50.3. Lemme rephrase.
Emacs with sql-mode is a great environment in general, to do database
work with SQLite database files.
But there are currently 3 problems:
----------------------------------
- With emacs -Q, it is impossible to use SQLite databases with a name,
that doesn't match ".*\\.\\(db\\|sqlite[23]?\\)". Contrariwise it
should be possible to work with sqlite databases with any name.
- With emacs -Q, if the SQLite database file to work with isn't in the
current directory then navigating to the file doesn't provide
completion of directory names. The user has to type every character
of the path by itself (with expection of very rare cases). This kind
of completion is so ubiquitous, at least within emacs while
selecting a file with the mini-buffer that you may not remeber
anymore how boring it in fact is if this feature is missing.
- With emacs -Q it is not possible to create a new SQLite database
with what sql-mode provides. There are clumsy work-arounds for this
sql-mode limitation but that should not be necessary.
All this deficiencies are related, because they have their root in one
implementation detail (see below, part "Technical details").
How to reproduce:
-----------------
emacs -Q
M-x sql-sqlite RET
This prompts the user for the database file to use.
- Try to select a database file with a name, that does not match
".*\\.\\(db\\|sqlite[23]?\\)" and you see you can't.
- Try to select a database outside the current directory, using TAB
completion for directory names on the way and you see, that it
doesn't work (for directory names not matching the same name pattern
as above, which is probably the overwhelming majority)
- Try to enter an up to now non-existing file (to create a new sqlite
database and to work on that) and you see you can't.
This is just the simplest recipt to demonstrate the problems. There
are also other use pattern, which suffer from this (and there is no
use pattern, to avoid them).
Is it important?
----------------
For user of sql-mode w/ product SQLite: Definitely yes. It seriously
cripples the usefulness of sql-mode for SQLite databases.
I'd estimate that the majority of the users, that work with SQLite
database files with the help of sql-mode will be hindered by at least
one of the decribed problems more sooner than later (and therfore giving
up to use emacs for this). Even if the user only ever want to work with
database file names, that match the default name pattern and never want
to create a new SQLite database from within emacs it is unlikely, that
he only want to work with database files out of the current directory.
More background information (you may skip this part):
----------------------------------------------------
SQLite is the most widely deployed database engine in the world today.
SQLite stores a SQL database (with multiple tables, indices, triggers,
and views) in a single disk file. SQLite is meant as an embedded SQL
database but the distribution includes also a command line tool called
sqlite3, to access or modify such database files with SQL commands.
Due to SQLites widespread usage there are literally myriads of SQlite
database files out there on almost every thinkable plattform, which a
user may wish to explore or modify with the help of emacs and
sql-mode.
Technical Details
-----------------
Sql-mode uses the sqlite cli based on comint-mode. To call the cli
application, it needs the file name of the database. It request that
from the user with a read-file-name() call (in sql-get-login-ext()):
(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)))))))
The above desribed three problems result from the fourth and the sixth
argument of that read-file-name() call.
The t value of the fourth argument is the reason for the third problem
above.
The plist value at the point above is the value of
sql-sqlite-login-params, which is by default:
((database :file ".*\\.\\(db\\|sqlite[23]?\\)"))
So the read-file-name use the predicate lamda: it matches the file
name againts the regexp in sql-sqlite-login-params. This explanes the
problems one and two from above.
What to do?
-----------
Well, anything would be better, than what is now.
The least invasive change would be this small patch (for 26.0.50.3):
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 9608a7d..1d9f123 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -933,7 +933,7 @@ sql-sqlite-options
:version "20.8"
:group 'SQL)
-(defcustom sql-sqlite-login-params '((database :file ".*\\.\\(db\\|sqlite[23]?\\)"))
+(defcustom sql-sqlite-login-params '((database :file nil))
"List of login parameters needed to connect to SQLite."
:type 'sql-login-params
:version "24.1"
@@ -2954,7 +2954,7 @@ sql-get-login-ext
((plist-member plist :file)
(expand-file-name
(read-file-name prompt
- (file-name-directory last-value) default t
+ (file-name-directory last-value) default 'confirm
(file-name-nondirectory last-value)
(when (plist-get plist :file)
`(lambda (f)
With this two changed lines and with emacs -Q all three described
problems are gone. Though, not really for good. If a user uses the whole
machinery and customize sql-sqlite-login-params, problem two would be
back.
Therefor I propose this slightly more elaborate patch:
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 9608a7d..c3c61f2 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -933,7 +933,7 @@ sql-sqlite-options
:version "20.8"
:group 'SQL)
-(defcustom sql-sqlite-login-params '((database :file ".*\\.\\(db\\|sqlite[23]?\\)"))
+(defcustom sql-sqlite-login-params '((database :file nil))
"List of login parameters needed to connect to SQLite."
:type 'sql-login-params
:version "24.1"
@@ -2954,13 +2954,15 @@ sql-get-login-ext
((plist-member plist :file)
(expand-file-name
(read-file-name prompt
- (file-name-directory last-value) default t
+ (file-name-directory last-value) default 'confirm
(file-name-nondirectory last-value)
(when (plist-get plist :file)
`(lambda (f)
- (string-match
- (concat "\\<" ,(plist-get plist :file) "\\>")
- (file-name-nondirectory f)))))))
+ (if (not(file-regular-p f))
+ t
+ (string-match
+ (concat "\\<" ,(plist-get plist :file) "\\>")
+ (file-name-nondirectory f))))))))
((plist-member plist :completion)
(completing-read prompt-def (plist-get plist :completion) nil t
Discussion of the proposed patch:
--------------------------------
There is no need for fear, a user may by mistake damage a non SQLite
file (by not restricting the file select to a small number of file name
suffixes (which would't be a great strategy. if such fear had ground).
Every SQLite database file has a 100 byte long database header described
here: https://www.sqlite.org/fileformat.html#the_database_header
At the first time the used cli programm sqlite3 has to read from or
write to the file, it checks this header bytes and refuses to alter the
file with an error msg ("Error: file is encrypted or is not a
database"). It is extremly unlikely (although, admitted, not completely
impossible), that a file starts with 100 bytes that make sense to
sqlite3, but is not a SQLite database file.
There is no strong convention amongst SQLite user about the suffix of
the database files. One user reported "One program I use, has 20
different suffixes, for the SQLite databases that it utilizes. Most of
its competitors use between 3 and 5 suffixes for the SQLite databases
that they utilize."
(https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg99952.html)
To some users, it may be helpful to customize sql-sqlite-login-params
(from its new default "complete every file name" by my proposed
patch). But to provide a default name pattern, that doesn't hinders
legitimate usage seems to be hopeless.
Customization of sql-sqlite-login-params is of course already possible
with current emacs. To work around the described problems in emacs I
have in my init.el:
(setq sql-sqlite-login-params '((database :file nil)))
This fixes the first two problems from above (the two most relevant).
But it is not only, that current emacs doesn't allow certain sane
operation for no good reason (using a SQLite database file with a
'wrong name') or lacks name completion while selecting a file with the
mini-buffer for a certain operation (emacs lacks completion???).
If a user notice this - and is an emacs enthusiast, beliving, that
there must be something, otherwise he would have give up on this tool
(emacs) for this purpose at this point - and start to tinker, it isn't
even obvious what the work-around is. E.g. the documentation of
sql-sqlite doesn't even mention sql-sqlite-login-params.
Rambling
--------
This miss-behaviour is annoying. It is unnecessary. It's a pity,
because otherwise sql-mode with SQLite database files is a fine tool.
It is in its core not about sql-mode architecture or its implementation
details, you don't need to know anything about that, its just about
knowing read-file-name and looking at that one occurrence of that in
sql.el.
I understand: thousands of open bugs and nobody actively maintaining
some files and all. Probably some kind soul could set a confirm tag,
so that I'm able to let rest the case, now that I've even provided
a patch. I've the customisation from above in my init.el, amongst
other cruft. I would love to remove that, somewhere in the next 20
years. Just for the few moments of the feeling, that my life had some
sense.
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#23566: sql-sqlite: selecting database file is crippled)
2017-01-01 3:13 ` Rolf Ade
@ 2017-01-01 4:03 ` npostavs
2017-01-03 0:19 ` Rolf Ade
0 siblings, 1 reply; 8+ messages in thread
From: npostavs @ 2017-01-01 4:03 UTC (permalink / raw)
To: Rolf Ade; +Cc: 23566
tags 23566 patch
quit
Hi,
I'm sorry that nobody responded to your bug report earlier. I expect
the problem is that there aren't any sqlite experienced people working
on Emacs right now (at least, ignorance of sql(ite) is why *I* passed on
this bug the first time around).
Rolf Ade <rolf@pointsman.de> writes:
> Therefor I propose this slightly more elaborate patch:
>
> diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
> index 9608a7d..c3c61f2 100644
> --- a/lisp/progmodes/sql.el
> +++ b/lisp/progmodes/sql.el
> @@ -933,7 +933,7 @@ sql-sqlite-options
> :version "20.8"
> :group 'SQL)
>
> -(defcustom sql-sqlite-login-params '((database :file ".*\\.\\(db\\|sqlite[23]?\\)"))
> +(defcustom sql-sqlite-login-params '((database :file nil))
> "List of login parameters needed to connect to SQLite."
> :type 'sql-login-params
> :version "24.1"
The :version should be updated when the default value is changed.
> @@ -2954,13 +2954,15 @@ sql-get-login-ext
> ((plist-member plist :file)
> (expand-file-name
> (read-file-name prompt
> - (file-name-directory last-value) default t
> + (file-name-directory last-value) default 'confirm
> (file-name-nondirectory last-value)
> (when (plist-get plist :file)
> `(lambda (f)
> - (string-match
> - (concat "\\<" ,(plist-get plist :file) "\\>")
> - (file-name-nondirectory f)))))))
> + (if (not(file-regular-p f))
^^
missed a space here
> + t
> + (string-match
> + (concat "\\<" ,(plist-get plist :file) "\\>")
> + (file-name-nondirectory f))))))))
>
> ((plist-member plist :completion)
> (completing-read prompt-def (plist-get plist :completion) nil t
>
This looks reasonable to me, and is small enough to install without
copyright assignment. Could you add a commit message too? (format as
described in CONTRIBUTE)
>
> There is no need for fear, a user may by mistake damage a non SQLite
> file (by not restricting the file select to a small number of file name
> suffixes (which would't be a great strategy. if such fear had ground).
> Every SQLite database file has a 100 byte long database header described
> here: https://www.sqlite.org/fileformat.html#the_database_header
I think the idea is more to restrict the completion to database files
for convenience, not protection from damage. But since there doesn't
seem to be much of a convention for sqlite file extensions, setting the
default to nil seems okay.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#23566: sql-sqlite: selecting database file is crippled)
2017-01-01 4:03 ` npostavs
@ 2017-01-03 0:19 ` Rolf Ade
2017-01-03 23:42 ` Rolf Ade
0 siblings, 1 reply; 8+ messages in thread
From: Rolf Ade @ 2017-01-03 0:19 UTC (permalink / raw)
To: npostavs; +Cc: 23566
Thank you to take care.
npostavs@users.sourceforge.net writes:
> Rolf Ade <rolf@pointsman.de> writes:
>
>> Therefor I propose this slightly more elaborate patch:
>>
>> [...]
>> :version "24.1"
>
> The :version should be updated when the default value is changed.
Done, see below.
>
>> [...]
>> + (if (not(file-regular-p f))
> ^^
> missed a space here
Thanks for the review and for spotting this.
> This looks reasonable to me, and is small enough to install without
> copyright assignment. Could you add a commit message too? (format as
> described in CONTRIBUTE)
Commit message:
Fix selecting SQLite database files with sql-mode (bug#23566)
* lisp/progmodes/sql.el (sql-sqlite-login-params): Allow any name as
SQLite database file name, by default.
(sql-get-login-ext): Fixed read-file-name arguments to provide
path completion even if a database name pattern is customized and to
allow creation of new SQLite database files.
Copyright-paperwork-exempt: yes
>> There is no need for fear, a user may by mistake damage a non SQLite
>> file (by not restricting the file select to a small number of file name
>> suffixes (which would't be a great strategy. if such fear had ground).
>> Every SQLite database file has a 100 byte long database header described
>> here: https://www.sqlite.org/fileformat.html#the_database_header
>
> I think the idea is more to restrict the completion to database files
> for convenience, not protection from damage. But since there doesn't
> seem to be much of a convention for sqlite file extensions, setting the
> default to nil seems okay.
I agree. Most probably, the idea was to provide some
convenience. Therefor, I didn't removed the whole machinery but fixed
it.
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index d6c9516..55ba320 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -933,10 +933,10 @@ sql-sqlite-options
:version "20.8"
:group 'SQL)
-(defcustom sql-sqlite-login-params '((database :file ".*\\.\\(db\\|sqlite[23]?\\)"))
+(defcustom sql-sqlite-login-params '((database :file nil))
"List of login parameters needed to connect to SQLite."
:type 'sql-login-params
- :version "24.1"
+ :version "26.1"
:group 'SQL)
;; Customization for MySQL
@@ -2958,9 +2958,11 @@ sql-get-login-ext
(file-name-nondirectory last-value)
(when (plist-get plist :file)
`(lambda (f)
- (string-match
- (concat "\\<" ,(plist-get plist :file) "\\>")
- (file-name-nondirectory f)))))))
+ (if (not (file-regular-p f))
+ t
+ (string-match
+ (concat "\\<" ,(plist-get plist :file) "\\>")
+ (file-name-nondirectory f))))))))
((plist-member plist :completion)
(completing-read prompt-def (plist-get plist :completion) nil t
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#23566: sql-sqlite: selecting database file is crippled)
2017-01-03 0:19 ` Rolf Ade
@ 2017-01-03 23:42 ` Rolf Ade
2017-01-07 17:01 ` npostavs
0 siblings, 1 reply; 8+ messages in thread
From: Rolf Ade @ 2017-01-03 23:42 UTC (permalink / raw)
To: npostavs; +Cc: 23566
Rolf Ade <rolf@pointsman.de> writes:
> [...]
> diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
> index d6c9516..55ba320 100644
> --- a/lisp/progmodes/sql.el
> +++ b/lisp/progmodes/sql.el
> @@ -933,10 +933,10 @@ sql-sqlite-options
> :version "20.8"
> :group 'SQL)
>
> -(defcustom sql-sqlite-login-params '((database :file ".*\\.\\(db\\|sqlite[23]?\\)"))
> +(defcustom sql-sqlite-login-params '((database :file nil))
> "List of login parameters needed to connect to SQLite."
> :type 'sql-login-params
> - :version "24.1"
> + :version "26.1"
> :group 'SQL)
>
> ;; Customization for MySQL
> @@ -2958,9 +2958,11 @@ sql-get-login-ext
> (file-name-nondirectory last-value)
> (when (plist-get plist :file)
> `(lambda (f)
> - (string-match
> - (concat "\\<" ,(plist-get plist :file) "\\>")
> - (file-name-nondirectory f)))))))
> + (if (not (file-regular-p f))
> + t
> + (string-match
> + (concat "\\<" ,(plist-get plist :file) "\\>")
> + (file-name-nondirectory f))))))))
>
> ((plist-member plist :completion)
> (completing-read prompt-def (plist-get plist :completion) nil t
Sorry for any confusion - due to new years holidays I'm not on my main
box and I missed in my last patch the part "allow creation of new SQLite
database files".
Commit message:
Fix selecting SQLite database files with sql-mode (bug#23566)
* lisp/progmodes/sql.el (sql-sqlite-login-params): Allow any name as
SQLite database file name, by default.
(sql-get-login-ext): Fixed read-file-name arguments to provide
path completion even if a database name pattern is customized and to
allow creation of new SQLite database files.
Copyright-paperwork-exempt: yes
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index d6c9516..7156348 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -933,10 +933,10 @@ sql-sqlite-options
:version "20.8"
:group 'SQL)
-(defcustom sql-sqlite-login-params '((database :file ".*\\.\\(db\\|sqlite[23]?\\)"))
+(defcustom sql-sqlite-login-params '((database :file nil))
"List of login parameters needed to connect to SQLite."
:type 'sql-login-params
- :version "24.1"
+ :version "26.1"
:group 'SQL)
;; Customization for MySQL
@@ -2954,13 +2954,15 @@ sql-get-login-ext
((plist-member plist :file)
(expand-file-name
(read-file-name prompt
- (file-name-directory last-value) default t
+ (file-name-directory last-value) default 'confirm
(file-name-nondirectory last-value)
(when (plist-get plist :file)
`(lambda (f)
- (string-match
- (concat "\\<" ,(plist-get plist :file) "\\>")
- (file-name-nondirectory f)))))))
+ (if (not (file-regular-p f))
+ t
+ (string-match
+ (concat "\\<" ,(plist-get plist :file) "\\>")
+ (file-name-nondirectory f))))))))
((plist-member plist :completion)
(completing-read prompt-def (plist-get plist :completion) nil t
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#23566: sql-sqlite: selecting database file is crippled)
2017-01-03 23:42 ` Rolf Ade
@ 2017-01-07 17:01 ` npostavs
0 siblings, 0 replies; 8+ messages in thread
From: npostavs @ 2017-01-07 17:01 UTC (permalink / raw)
To: Rolf Ade; +Cc: 23566
tags 23566 fixed
close 23566 26.1
quit
Rolf Ade <rolf@pointsman.de> writes:
>
> Sorry for any confusion - due to new years holidays I'm not on my main
> box and I missed in my last patch the part "allow creation of new SQLite
> database files".
No worries, things like this are why I usually let patches "rest" a few
days before pusing. I've now pushed this to master.
2017-01-05 20:20:42 -0500 4873b57b8e48c068d285e229ea29a18cf5c6cc7a
Fix selecting SQLite database files with sql-mode (Bug#23566)
>
> Commit message:
>
> Fix selecting SQLite database files with sql-mode (bug#23566)
>
> * lisp/progmodes/sql.el (sql-sqlite-login-params): Allow any name as
> SQLite database file name, by default.
> (sql-get-login-ext): Fixed read-file-name arguments to provide
> path completion even if a database name pattern is customized and to
> allow creation of new SQLite database files.
>
> Copyright-paperwork-exempt: yes
>
> diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
By the way, if you're using git already, calling 'git format-patch'
gives a file containing both the patch and commit message together in a
format that can be easily applied with 'git am'.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-01-07 17:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17 20:02 bug#23566: 25.0.94; sql-sqlite: selecting database file is crippled rolf
[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
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.