all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#22596: 25.1.50; Broken prompt-regexp for sql-postgres
@ 2016-02-08  7:41 Steve
       [not found] ` <handler.22596.B.145491733432512.ack@debbugs.gnu.org>
  2016-04-24 21:04 ` Steve Purcell
  0 siblings, 2 replies; 8+ messages in thread
From: Steve @ 2016-02-08  7:41 UTC (permalink / raw)
  To: 22596



I'm using a database with a name like "blah_dev", and sql-mode doesn't
detect my prompt in a recent snapshot build of Emacs, started with -Q.

The :prompt-regexp for postgres in sql.el is "^\\w*=[#>] ", and in
sql-interactive-mode buffers it seems that "_" is not considered a word
character.

It seems like "\\w" should be replaced with a match which doesn't depend
on the current syntax table, e.g. "[[:alpha:]_]".





In GNU Emacs 25.1.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1507))
 of 2016-01-22 built on builder10-9.porkrind.org
Windowing system distributor 'Apple', version 10.3.1404
Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp''

Configured features:
NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US
  locale-coding-system: utf-8

Major mode: Help

Minor modes in effect:
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  company-quickhelp-mode: t
  shell-dirtrack-mode: t
  global-company-mode: t
  company-mode: t
  global-flycheck-mode: t
  diff-auto-refine-mode: t
  auto-compile-on-load-mode: t
  auto-compile-on-save-mode: t
  ipretty-mode: t
  global-rinari-mode: t
  rinari-minor-mode: t
  global-whitespace-cleanup-mode: t
  guide-key-mode: t
  hes-mode: t
  global-page-break-lines-mode: t
  page-break-lines-mode: t
  delete-selection-mode: t
  cua-mode: t
  show-paren-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-auto-revert-mode: t
  electric-pair-mode: t
  savehist-mode: t
  desktop-save-mode: t
  winner-mode: t
  ido-ubiquitous-mode: t
  ido-everywhere: t
  recentf-mode: t
  global-anzu-mode: t
  anzu-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-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
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Type M-x delete-other-windows to delete the help window.
Quit
Subword mode enabled in current buffer
Subword mode disabled in current buffer
200 matches (limit reached) [3 times]
194 matches
Quit [5 times]

uncompressing sql.el.gz...done
Mark saved where search started

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail re-builder align face-remap
cua-rect rect hippie-exp sql-indent sql move-dup character-fold misearch
multi-isearch gitconfig-mode conf-mode wgrep-ag wgrep grep vc-hg ag
find-dired browse-url org-capture bookmark linum magit-blame magit-stash
magit-bisect magit-remote magit-commit magit-sequence magit magit-apply
magit-wip magit-log magit-diff smerge-mode magit-core magit-autorevert
magit-process magit-popup magit-mode magit-git crm magit-section
magit-utils git-commit log-edit message rfc822 mml mml-sec epg
mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log with-editor
async-bytecomp async tramp-sh debug cal-iso diary-lib diary-loaddefs
hl-line org-agenda descr-text smex company-quickhelp pos-tip haml-mode
markdown-mode textile-mode css-mode cursor-sensor js2-imenu-extras
js2-mode js cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs checkdoc tramp-cache tramp
tramp-compat tramp-loaddefs trampver view tabify vc-bzr vc-src vc-sccs
vc-svn vc-cvs vc-rcs diff-hl-dired mmm-sample mmm-mode mmm-univ
mmm-class tidy rainbow-mode color mmm-erb mmm-region mmm-utils tagedit
sgml-mode cap-words superword subword robe url-http tls gnutls url-auth
url-gw puny url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap org-element org-rmail org-mhe
org-irc org-info org-gnus org-docview doc-view image-mode dired-sort
dired+ image-dired image-file dired-x dired-aux dired dired-loaddefs
org-bibtex bibtex org-bbdb org-w3m ob-sqlite ob-sh shell ob-ruby
ob-python ob-octave ob-ledger ob-latex ob-gnuplot ob-dot ob-ditaa ob-R
org-clock org org-macro org-footnote org-pcomplete org-list org-faces
org-entities noutline outline org-version ob-emacs-lisp ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint ob-core ob-eval
org-compat org-macs org-loaddefs format-spec cal-menu calendar
cal-loaddefs sh-script executable yaml-mode company-oddmuse
company-keywords company-etags company-gtags company-dabbrev-code
company-dabbrev company-files company-capf company-cmake company-xcode
company-clang company-semantic company-eclim company-template
company-css company-nxml company-bbdb company-robe company disp-table
vc-git vc-darcs xml package-build mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums flycheck-package lisp-mnt
flycheck find-func subr-x elisp-slime-nav etags xref project redshank
skeleton rainbow-delimiters aggressive-indent highlight-quoted
highlight-symbol diff-hl vc-dir ewoc vc vc-dispatcher diff-mode
bug-reference paredit-everywhere paredit goto-addr init init-locales
init-local session sanityinc-tomorrow-bright-theme
color-theme-sanityinc-tomorrow server jka-compr init-ledger init-dash
init-misc init-common-lisp init-clojure-cider init-clojure init-slime
init-lisp cl-lib-highlight auto-compile packed ipretty pp init-paredit
init-sql init-rails rinari json map jump inflections findr
ruby-compilation which-func imenu pcomplete inf-ruby compile comint
ansi-color ruby-mode smie init-ruby-mode derived init-elm init-haskell
init-python-mode init-haml init-css init-html init-nxml init-org
init-php init-javascript easy-mmode init-erlang erlang-start init-csv
init-markdown init-textile init-crontab init-compile init-github
init-git init-darcs init-vc init-fci init-whitespace
whitespace-cleanup-mode whitespace init-editing-utils guide-key s popwin
dash highlight-escape-sequences whole-line-or-region page-break-lines
delsel cua-base paren undo-tree diff autorevert filenotify elec-pair
init-mmm mmm-auto mmm-vars mmm-compat init-fonts init-sessions savehist
desktop frameset init-windows windmove switch-window quail winner ring
init-company init-hippie-expand init-ido ido-ubiquitous
ido-completing-read+ cus-edit cus-start cus-load ido seq init-recentf
recentf tree-widget wid-edit init-flycheck init-ibuffer ibuf-macs
init-uniquify init-grep init-isearch diminish anzu thingatpt init-dired
init-gui-frames init-osx-keys edmacro kmacro init-themes init-xterm
init-frame-hooks init-exec-path exec-path-from-shell init-elpa fullframe
finder-inf rx slime-autoloads info package epg-config url-handlers
url-parse auth-source eieio byte-opt bytecomp byte-compile cl-extra
cconv eieio-core cl-macs eieio-loaddefs gnus-util mm-util help-fns
help-mode easymenu mail-prsvr password-cache url-vars init-site-lisp
cl-seq cl gv cl-loaddefs pcase cl-lib init-utils init-compat
init-benchmarking advice time-date mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win ucs-normalize
term/common-win 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 obarray 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 kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 1405822 192319)
 (symbols 48 72361 1)
 (miscs 40 10028 9847)
 (strings 32 195944 214186)
 (string-bytes 1 5887053)
 (vectors 16 94095)
 (vector-slots 8 2228073 154483)
 (floats 8 1325 2291)
 (intervals 56 25797 431)
 (buffers 976 157))





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

* bug#22596: Acknowledgement (25.1.50; Broken prompt-regexp for sql-postgres)
       [not found] ` <handler.22596.B.145491733432512.ack@debbugs.gnu.org>
@ 2016-02-08  7:55   ` Steve Purcell
  2016-02-08  8:03     ` Steve Purcell
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Purcell @ 2016-02-08  7:55 UTC (permalink / raw)
  To: 22596

Patch sent to emacs-devel list.





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

* bug#22596: Acknowledgement (25.1.50; Broken prompt-regexp for sql-postgres)
  2016-02-08  7:55   ` bug#22596: Acknowledgement (25.1.50; Broken prompt-regexp for sql-postgres) Steve Purcell
@ 2016-02-08  8:03     ` Steve Purcell
  2016-02-09  8:18       ` Steve Purcell
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Purcell @ 2016-02-08  8:03 UTC (permalink / raw)
  To: 22596

From 8f2be35bec54b752708281776f96c991903245d2 Mon Sep 17 00:00:00 2001
From: Steve Purcell <steve@sanityinc.com>
Date: Mon, 8 Feb 2016 20:47:43 +1300
Subject: [PATCH] Safer prompt-regexp for postgres/vertica in
 sql-interactive-mode

Fixes issue 22596, whereby "_" is now not considered a word constituent
character in sql-interactive-mode, so prompts like "foo_dev# " are not
correctly detected.
---
 lisp/progmodes/sql.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index fd59f46..90c8dfe 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -462,9 +462,9 @@ sql-product-alist
      :list-all ("\\d+" . "\\dS+")
      :list-table ("\\d+ %s" . "\\dS+ %s")
      :completion-object sql-postgres-completion-object
-     :prompt-regexp "^\\w*=[#>] "
+     :prompt-regexp "^[[:alpha:]_]*=[#>] "
      :prompt-length 5
-     :prompt-cont-regexp "^\\w*[-(][#>] "
+     :prompt-cont-regexp "^[[:alpha:]_]*[-(][#>] "
      :input-filter sql-remove-tabs-filter
      :terminator ("\\(^\\s-*\\\\g$\\|;\\)" . "\\g"))
 
@@ -514,9 +514,9 @@ sql-product-alist
      :sqli-comint-func sql-comint-vertica
      :list-all ("\\d" . "\\dS")
      :list-table "\\d %s"
-     :prompt-regexp "^\\w*=[#>] "
+     :prompt-regexp "^[[:alpha:]_]*=[#>] "
      :prompt-length 5
-     :prompt-cont-regexp "^\\w*[-(][#>] ")
+     :prompt-cont-regexp "^[[:alpha:]_]*[-(][#>] ")
     )
   "An alist of product specific configuration settings.
 
-- 
2.7.1







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

* bug#22596: Acknowledgement (25.1.50; Broken prompt-regexp for sql-postgres)
  2016-02-08  8:03     ` Steve Purcell
@ 2016-02-09  8:18       ` Steve Purcell
  2016-02-23  4:02         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Purcell @ 2016-02-09  8:18 UTC (permalink / raw)
  To: 22596

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

Updated patch is attached, following discussion on emacs-devel. (I have a CA on file, btw.)


[-- Attachment #2: 0001-Safer-prompt-regexp-for-postgres-vertica-in-sql-inte.patch --]
[-- Type: application/octet-stream, Size: 2088 bytes --]

From fcbbb4598f7e7c5d9d9a460ef3af668c84f907c6 Mon Sep 17 00:00:00 2001
From: Steve Purcell <steve@sanityinc.com>
Date: Mon, 8 Feb 2016 20:47:43 +1300
Subject: [PATCH] Safer prompt-regexp for postgres/vertica in
 sql-interactive-mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes issue 22596, whereby "_" is now not considered a word constituent
character in sql-interactive-mode, so prompts like "foo_dev# " are not
correctly detected. Rather than piggy-back on the symbol table, we
explicitly match against alphanumeric chars or "_".

In the general case, almost any characters are valid in a PostgreSQL
database name, so we must choose between matching “reasonable” database
names with a tight regexp, or matching all allowable names with a
permissive regexp which would likely match all sorts of other buffer
text. This commit follows the former approach.
---
 lisp/progmodes/sql.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index fd59f46..be7c4dd 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -462,9 +462,9 @@ sql-product-alist
      :list-all ("\\d+" . "\\dS+")
      :list-table ("\\d+ %s" . "\\dS+ %s")
      :completion-object sql-postgres-completion-object
-     :prompt-regexp "^\\w*=[#>] "
+     :prompt-regexp "^[[:alnum:]_]*=[#>] "
      :prompt-length 5
-     :prompt-cont-regexp "^\\w*[-(][#>] "
+     :prompt-cont-regexp "^[[:alnum:]_]*[-(][#>] "
      :input-filter sql-remove-tabs-filter
      :terminator ("\\(^\\s-*\\\\g$\\|;\\)" . "\\g"))
 
@@ -514,9 +514,9 @@ sql-product-alist
      :sqli-comint-func sql-comint-vertica
      :list-all ("\\d" . "\\dS")
      :list-table "\\d %s"
-     :prompt-regexp "^\\w*=[#>] "
+     :prompt-regexp "^[[:alnum:]_]*=[#>] "
      :prompt-length 5
-     :prompt-cont-regexp "^\\w*[-(][#>] ")
+     :prompt-cont-regexp "^[[:alnum:]_]*[-(][#>] ")
     )
   "An alist of product specific configuration settings.
 
-- 
2.7.1


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

* bug#22596: Acknowledgement (25.1.50; Broken prompt-regexp for sql-postgres)
  2016-02-09  8:18       ` Steve Purcell
@ 2016-02-23  4:02         ` Lars Ingebrigtsen
  2016-04-24  6:46           ` Steve Purcell
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-23  4:02 UTC (permalink / raw)
  To: Steve Purcell; +Cc: 22596

Steve Purcell <steve@sanityinc.com> writes:

> Fixes issue 22596, whereby "_" is now not considered a word constituent
> character in sql-interactive-mode, so prompts like "foo_dev# " are not
> correctly detected. Rather than piggy-back on the symbol table, we
> explicitly match against alphanumeric chars or "_".
>
> In the general case, almost any characters are valid in a PostgreSQL
> database name, so we must choose between matching .reasonable. database
> names with a tight regexp, or matching all allowable names with a
> permissive regexp which would likely match all sorts of other buffer
> text. This commit follows the former approach.

[...]

> -     :prompt-regexp "^\\w*=[#>] "
> +     :prompt-regexp "^[[:alnum:]_]*=[#>] "
>       :prompt-length 5
> -     :prompt-cont-regexp "^\\w*[-(][#>] "
> +     :prompt-cont-regexp "^[[:alnum:]_]*[-(][#>] "

This looks reasonable to me, but I'm not an SQL mode user, so I can't
really test it.  Does anybody have an objection to this change?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#22596: Acknowledgement (25.1.50; Broken prompt-regexp for sql-postgres)
  2016-02-23  4:02         ` Lars Ingebrigtsen
@ 2016-04-24  6:46           ` Steve Purcell
  2016-04-24 11:45             ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Purcell @ 2016-04-24  6:46 UTC (permalink / raw)
  To: 22596

This is still broken for me - would somebody mind applying the patch please?





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

* bug#22596: Acknowledgement (25.1.50; Broken prompt-regexp for sql-postgres)
  2016-04-24  6:46           ` Steve Purcell
@ 2016-04-24 11:45             ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2016-04-24 11:45 UTC (permalink / raw)
  To: Steve Purcell; +Cc: 22596

Steve Purcell <steve@sanityinc.com> writes:

> This is still broken for me - would somebody mind applying the patch please?

Applied now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#22596: Acknowledgement (25.1.50; Broken prompt-regexp for sql-postgres)
  2016-02-08  7:41 bug#22596: 25.1.50; Broken prompt-regexp for sql-postgres Steve
       [not found] ` <handler.22596.B.145491733432512.ack@debbugs.gnu.org>
@ 2016-04-24 21:04 ` Steve Purcell
  1 sibling, 0 replies; 8+ messages in thread
From: Steve Purcell @ 2016-04-24 21:04 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 22596

[-- Attachment #1: Type: text/html, Size: 35 bytes --]

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

end of thread, other threads:[~2016-04-24 21:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-08  7:41 bug#22596: 25.1.50; Broken prompt-regexp for sql-postgres Steve
     [not found] ` <handler.22596.B.145491733432512.ack@debbugs.gnu.org>
2016-02-08  7:55   ` bug#22596: Acknowledgement (25.1.50; Broken prompt-regexp for sql-postgres) Steve Purcell
2016-02-08  8:03     ` Steve Purcell
2016-02-09  8:18       ` Steve Purcell
2016-02-23  4:02         ` Lars Ingebrigtsen
2016-04-24  6:46           ` Steve Purcell
2016-04-24 11:45             ` Lars Magne Ingebrigtsen
2016-04-24 21:04 ` Steve Purcell

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.