From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: rolf@pointsman.de Newsgroups: gmane.emacs.bugs Subject: bug#23566: 25.0.94; sql-sqlite: selecting database file is crippled Date: Tue, 17 May 2016 22:02:49 +0200 Message-ID: <87posko3km.fsf@linux-qg7d.i-did-not-set--mail-host-address--so-tickle-me> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1463538599 18823 80.91.229.3 (18 May 2016 02:29:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 May 2016 02:29:59 +0000 (UTC) To: 23566@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 18 04:29:47 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b2rF3-0005ai-Tk for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 May 2016 04:29:46 +0200 Original-Received: from localhost ([::1]:42440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2rF3-0005a1-39 for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 May 2016 22:29:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2qU0-000423-FB for bug-gnu-emacs@gnu.org; Tue, 17 May 2016 21:41:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2qTu-0000Je-1D for bug-gnu-emacs@gnu.org; Tue, 17 May 2016 21:41:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44045) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2qTt-0000JT-U2 for bug-gnu-emacs@gnu.org; Tue, 17 May 2016 21:41:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b2qTt-0006sJ-Pr for bug-gnu-emacs@gnu.org; Tue, 17 May 2016 21:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: rolf@pointsman.de Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 May 2016 01:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 23566 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.146353563826367 (code B ref -1); Wed, 18 May 2016 01:41:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 May 2016 01:40:38 +0000 Original-Received: from localhost ([127.0.0.1]:56376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b2qTV-0006rD-Pv for submit@debbugs.gnu.org; Tue, 17 May 2016 21:40:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40284) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b2qTU-0006r0-8g for submit@debbugs.gnu.org; Tue, 17 May 2016 21:40:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2qTL-0008Q2-Ek for submit@debbugs.gnu.org; Tue, 17 May 2016 21:40:31 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:47099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2qTL-0008Ou-Bk for submit@debbugs.gnu.org; Tue, 17 May 2016 21:40:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2qTE-0005sS-D5 for bug-gnu-emacs@gnu.org; Tue, 17 May 2016 21:40:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2lCl-0006nl-S3 for bug-gnu-emacs@gnu.org; Tue, 17 May 2016 16:03:03 -0400 Original-Received: from mxout3.interscholz.de ([85.236.196.238]:40916) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2lCl-0006la-HP for bug-gnu-emacs@gnu.org; Tue, 17 May 2016 16:02:59 -0400 Original-Received: from localhost (mxout3 [127.0.0.1]) by mxout3.interscholz.de (Postfix) with ESMTP id 7297720D12 for ; Tue, 17 May 2016 22:02:52 +0200 (CEST) X-Virus-Scanned: interscholz amavisd-new at mxout3.interscholz.de Original-Received: from server.web01.interscholz.net (server.web01.interscholz.net [85.236.196.138]) by mxout3.interscholz.de (Postfix) with ESMTP id A7FF120AD8 for ; Tue, 17 May 2016 22:02:51 +0200 (CEST) Original-Received: from linux-qg7d.site (p4FFBE6E1.dip0.t-ipconnect.de [79.251.230.225]) by server.web01.interscholz.net (Postfix) with ESMTPSA id F2DEE34036D for ; Tue, 17 May 2016 22:02:50 +0200 (CEST) Original-Received: by linux-qg7d.site (Postfix, from userid 1000) id 4EEFB18593; Tue, 17 May 2016 22:02:49 +0200 (CEST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:118371 Archived-At: 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 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))))))) 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))