unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
@ 2017-06-07  9:31 Thierry Volpiatto
  2017-06-07 15:33 ` Eli Zaretskii
  2017-06-10 16:15 ` Johan Bockgård
  0 siblings, 2 replies; 17+ messages in thread
From: Thierry Volpiatto @ 2017-06-07  9:31 UTC (permalink / raw)
  To: 27272


If no objections can I push this ?
Thanks.

master 27cdf2989e82644567553f83ee9ce3f7e99bfc27
Author:     Thierry Volpiatto <thierry.volpiatto@gmail.com>
AuthorDate: Wed Jun 7 11:25:01 2017 +0200
Commit:     Thierry Volpiatto <thierry.volpiatto@gmail.com>
CommitDate: Wed Jun 7 11:25:01 2017 +0200

Parent:     43885eac09d More authors.el updates
Merged:     master
Containing: master
Follows:    emacs-25.1 (129069)

Fix eldoc with positional arg among keyword args.

* lisp/progmodes/elisp-mode.el (elisp--highlight-function-argument):
Switch to indexed arg searching when no keyword found behind arg.

1 file changed, 3 insertions(+), 3 deletions(-)
lisp/progmodes/elisp-mode.el | 6 +++---

modified   lisp/progmodes/elisp-mode.el
@@ -1416,7 +1416,7 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
       (let* (case-fold-search
              key-have-value
              (sym-name (symbol-name sym))
-             (cur-w (current-word))
+             (cur-w (current-word t))
              (args-lst-ak (cdr (member "&key" args-lst)))
              (limit (save-excursion
                       (when (re-search-backward sym-name nil t)
@@ -1425,7 +1425,7 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
                         (substring cur-w 1)
                       (save-excursion
                         (let (split)
-                          (when (re-search-backward ":\\([^()\n]*\\)" limit t)
+                          (when (re-search-backward ":\\([^ ()\n]*\\)" limit t)
                             (setq split (split-string (match-string 1) " " t))
                             (prog1 (car split)
                               (when (cdr split)
@@ -1437,7 +1437,7 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
                                  args-lst-ak
                                  (not (member (upcase cur-a) args-lst-ak))
                                  (upcase (car (last args-lst-ak))))))
-        (unless (string= cur-w sym-name)
+        (unless (and cur-w (string= cur-w sym-name))
           ;; The last keyword have already a value
           ;; i.e :foo a b and cursor is at b.
           ;; If signature have also `&rest'





In GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2017-04-22 built on dell-14z
Windowing system distributor 'The X.Org Foundation', version 11.0.11701000
System Description:	Linux Mint 17.3 Rosa

Configured using:
 'configure CFLAGS=-O3'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_MONETARY: fr_FR.UTF-8
  value of $LC_NUMERIC: fr_FR.UTF-8
  value of $LC_TIME: fr_FR.UTF-8
  value of $LANG: fr_FR.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  global-git-gutter-mode: t
  git-gutter-mode: t
  eldoc-in-minibuffer-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  diff-auto-refine-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  global-git-commit-mode: t
  psession-mode: t
  dired-async-mode: t
  display-time-mode: t
  winner-mode: t
  auto-image-file-mode: t
  savehist-mode: t
  show-paren-mode: t
  helm-descbinds-mode: t
  helm-top-poll-mode: t
  helm-push-mark-mode: t
  helm-mode: t
  shell-dirtrack-mode: t
  helm-adaptive-mode: t
  helm-popup-tip-mode: t
  async-bytecomp-package-mode: t
  minibuffer-depth-indicate-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
[C-t] show common commands, [?] describe events, [C-h i] show manual
Running git commit -- [2 times]
Diffing changes to be committed (C-g to abort diffing) [2 times]
When done with a buffer, type C-c C-c
Type C-c C-c to finish, or C-c C-k to cancel
Saving file /home/thierry/labo/emacs/.git/COMMIT_EDITMSG...
Wrote /home/thierry/labo/emacs/.git/COMMIT_EDITMSG
Git finished [2 times]
Drop all stashes in refs/stash? (y or n) y [2 times]
Mark set
next-line: End of buffer [12 times]

Load-path shadows:
/home/thierry/.emacs.d/elpa/org-20170515/ob-keys hides /usr/local/share/emacs/25.2/lisp/org/ob-keys
/home/thierry/.emacs.d/elpa/org-20170515/ob-ref hides /usr/local/share/emacs/25.2/lisp/org/ob-ref
/home/thierry/.emacs.d/elpa/org-20170515/ox-org hides /usr/local/share/emacs/25.2/lisp/org/ox-org
/home/thierry/.emacs.d/elpa/org-20170515/ob-sass hides /usr/local/share/emacs/25.2/lisp/org/ob-sass
/home/thierry/.emacs.d/elpa/org-20170515/org-bbdb hides /usr/local/share/emacs/25.2/lisp/org/org-bbdb
/home/thierry/.emacs.d/elpa/org-20170515/ox-latex hides /usr/local/share/emacs/25.2/lisp/org/ox-latex
/home/thierry/.emacs.d/elpa/org-20170515/ox-beamer hides /usr/local/share/emacs/25.2/lisp/org/ox-beamer
/home/thierry/.emacs.d/elpa/org-20170515/org-crypt hides /usr/local/share/emacs/25.2/lisp/org/org-crypt
/home/thierry/.emacs.d/elpa/org-20170515/ob-maxima hides /usr/local/share/emacs/25.2/lisp/org/ob-maxima
/home/thierry/.emacs.d/elpa/org-20170515/ob-R hides /usr/local/share/emacs/25.2/lisp/org/ob-R
/home/thierry/.emacs.d/elpa/org-20170515/ob-eval hides /usr/local/share/emacs/25.2/lisp/org/ob-eval
/home/thierry/.emacs.d/elpa/org-20170515/org-datetree hides /usr/local/share/emacs/25.2/lisp/org/org-datetree
/home/thierry/.emacs.d/elpa/org-20170515/org-element hides /usr/local/share/emacs/25.2/lisp/org/org-element
/home/thierry/.emacs.d/elpa/org-20170515/ob-core hides /usr/local/share/emacs/25.2/lisp/org/ob-core
/home/thierry/.emacs.d/elpa/org-20170515/ox-md hides /usr/local/share/emacs/25.2/lisp/org/ox-md
/home/thierry/.emacs.d/elpa/org-20170515/org-indent hides /usr/local/share/emacs/25.2/lisp/org/org-indent
/home/thierry/.emacs.d/elpa/org-20170515/ox hides /usr/local/share/emacs/25.2/lisp/org/ox
/home/thierry/.emacs.d/elpa/org-20170515/ob-fortran hides /usr/local/share/emacs/25.2/lisp/org/ob-fortran
/home/thierry/.emacs.d/elpa/org-20170515/ob-matlab hides /usr/local/share/emacs/25.2/lisp/org/ob-matlab
/home/thierry/.emacs.d/elpa/org-20170515/org-macro hides /usr/local/share/emacs/25.2/lisp/org/org-macro
/home/thierry/.emacs.d/elpa/org-20170515/ox-texinfo hides /usr/local/share/emacs/25.2/lisp/org/ox-texinfo
/home/thierry/.emacs.d/elpa/org-20170515/ob-sqlite hides /usr/local/share/emacs/25.2/lisp/org/ob-sqlite
/home/thierry/.emacs.d/elpa/org-20170515/org-faces hides /usr/local/share/emacs/25.2/lisp/org/org-faces
/home/thierry/.emacs.d/elpa/org-20170515/org-pcomplete hides /usr/local/share/emacs/25.2/lisp/org/org-pcomplete
/home/thierry/.emacs.d/elpa/org-20170515/org-mouse hides /usr/local/share/emacs/25.2/lisp/org/org-mouse
/home/thierry/.emacs.d/elpa/org-20170515/ob-emacs-lisp hides /usr/local/share/emacs/25.2/lisp/org/ob-emacs-lisp
/home/thierry/.emacs.d/elpa/org-20170515/org-archive hides /usr/local/share/emacs/25.2/lisp/org/org-archive
/home/thierry/.emacs.d/elpa/org-20170515/org-capture hides /usr/local/share/emacs/25.2/lisp/org/org-capture
/home/thierry/.emacs.d/elpa/org-20170515/ob-awk hides /usr/local/share/emacs/25.2/lisp/org/ob-awk
/home/thierry/.emacs.d/elpa/org-20170515/ob-octave hides /usr/local/share/emacs/25.2/lisp/org/ob-octave
/home/thierry/.emacs.d/elpa/org-20170515/org-timer hides /usr/local/share/emacs/25.2/lisp/org/org-timer
/home/thierry/.emacs.d/elpa/org-20170515/ob-sql hides /usr/local/share/emacs/25.2/lisp/org/ob-sql
/home/thierry/.emacs.d/elpa/org-20170515/ob-latex hides /usr/local/share/emacs/25.2/lisp/org/ob-latex
/home/thierry/.emacs.d/elpa/org-20170515/org-macs hides /usr/local/share/emacs/25.2/lisp/org/org-macs
/home/thierry/.emacs.d/elpa/org-20170515/org-rmail hides /usr/local/share/emacs/25.2/lisp/org/org-rmail
/home/thierry/.emacs.d/elpa/org-20170515/org-w3m hides /usr/local/share/emacs/25.2/lisp/org/org-w3m
/home/thierry/.emacs.d/elpa/org-20170515/ob-io hides /usr/local/share/emacs/25.2/lisp/org/ob-io
/home/thierry/.emacs.d/elpa/org-20170515/ob hides /usr/local/share/emacs/25.2/lisp/org/ob
/home/thierry/.emacs.d/elpa/org-20170515/ob-perl hides /usr/local/share/emacs/25.2/lisp/org/ob-perl
/home/thierry/.emacs.d/elpa/org-20170515/ob-mscgen hides /usr/local/share/emacs/25.2/lisp/org/ob-mscgen
/home/thierry/.emacs.d/elpa/org-20170515/ob-lilypond hides /usr/local/share/emacs/25.2/lisp/org/ob-lilypond
/home/thierry/.emacs.d/elpa/org-20170515/org-footnote hides /usr/local/share/emacs/25.2/lisp/org/org-footnote
/home/thierry/.emacs.d/elpa/org-20170515/ob-java hides /usr/local/share/emacs/25.2/lisp/org/ob-java
/home/thierry/.emacs.d/elpa/org-20170515/ox-html hides /usr/local/share/emacs/25.2/lisp/org/ox-html
/home/thierry/.emacs.d/elpa/org-20170515/ob-haskell hides /usr/local/share/emacs/25.2/lisp/org/ob-haskell
/home/thierry/.emacs.d/elpa/org-20170515/org-docview hides /usr/local/share/emacs/25.2/lisp/org/org-docview
/home/thierry/.emacs.d/elpa/org-20170515/ob-comint hides /usr/local/share/emacs/25.2/lisp/org/ob-comint
/home/thierry/.emacs.d/elpa/org-20170515/ob-css hides /usr/local/share/emacs/25.2/lisp/org/ob-css
/home/thierry/.emacs.d/elpa/org-20170515/ob-ditaa hides /usr/local/share/emacs/25.2/lisp/org/ob-ditaa
/home/thierry/.emacs.d/elpa/org-20170515/ob-scala hides /usr/local/share/emacs/25.2/lisp/org/ob-scala
/home/thierry/.emacs.d/elpa/org-20170515/org hides /usr/local/share/emacs/25.2/lisp/org/org
/home/thierry/.emacs.d/elpa/org-20170515/org-mobile hides /usr/local/share/emacs/25.2/lisp/org/org-mobile
/home/thierry/.emacs.d/elpa/org-20170515/ob-lisp hides /usr/local/share/emacs/25.2/lisp/org/ob-lisp
/home/thierry/.emacs.d/elpa/org-20170515/ob-gnuplot hides /usr/local/share/emacs/25.2/lisp/org/ob-gnuplot
/home/thierry/.emacs.d/elpa/org-20170515/org-src hides /usr/local/share/emacs/25.2/lisp/org/org-src
/home/thierry/.emacs.d/elpa/org-20170515/ox-ascii hides /usr/local/share/emacs/25.2/lisp/org/ox-ascii
/home/thierry/.emacs.d/elpa/org-20170515/ob-calc hides /usr/local/share/emacs/25.2/lisp/org/ob-calc
/home/thierry/.emacs.d/elpa/org-20170515/org-irc hides /usr/local/share/emacs/25.2/lisp/org/org-irc
/home/thierry/.emacs.d/elpa/org-20170515/org-loaddefs hides /usr/local/share/emacs/25.2/lisp/org/org-loaddefs
/home/thierry/.emacs.d/elpa/org-20170515/org-install hides /usr/local/share/emacs/25.2/lisp/org/org-install
/home/thierry/.emacs.d/elpa/org-20170515/org-info hides /usr/local/share/emacs/25.2/lisp/org/org-info
/home/thierry/.emacs.d/elpa/org-20170515/ob-plantuml hides /usr/local/share/emacs/25.2/lisp/org/ob-plantuml
/home/thierry/.emacs.d/elpa/org-20170515/org-feed hides /usr/local/share/emacs/25.2/lisp/org/org-feed
/home/thierry/.emacs.d/elpa/org-20170515/org-version hides /usr/local/share/emacs/25.2/lisp/org/org-version
/home/thierry/.emacs.d/elpa/org-20170515/ob-makefile hides /usr/local/share/emacs/25.2/lisp/org/ob-makefile
/home/thierry/.emacs.d/elpa/org-20170515/org-entities hides /usr/local/share/emacs/25.2/lisp/org/org-entities
/home/thierry/.emacs.d/elpa/org-20170515/ob-python hides /usr/local/share/emacs/25.2/lisp/org/ob-python
/home/thierry/.emacs.d/elpa/org-20170515/ob-ledger hides /usr/local/share/emacs/25.2/lisp/org/ob-ledger
/home/thierry/.emacs.d/elpa/org-20170515/ox-man hides /usr/local/share/emacs/25.2/lisp/org/ox-man
/home/thierry/.emacs.d/elpa/org-20170515/ob-shen hides /usr/local/share/emacs/25.2/lisp/org/ob-shen
/home/thierry/.emacs.d/elpa/org-20170515/org-inlinetask hides /usr/local/share/emacs/25.2/lisp/org/org-inlinetask
/home/thierry/.emacs.d/elpa/org-20170515/org-list hides /usr/local/share/emacs/25.2/lisp/org/org-list
/home/thierry/.emacs.d/elpa/org-20170515/ox-publish hides /usr/local/share/emacs/25.2/lisp/org/ox-publish
/home/thierry/.emacs.d/elpa/org-20170515/org-gnus hides /usr/local/share/emacs/25.2/lisp/org/org-gnus
/home/thierry/.emacs.d/elpa/org-20170515/org-agenda hides /usr/local/share/emacs/25.2/lisp/org/org-agenda
/home/thierry/.emacs.d/elpa/org-20170515/org-id hides /usr/local/share/emacs/25.2/lisp/org/org-id
/home/thierry/.emacs.d/elpa/org-20170515/org-plot hides /usr/local/share/emacs/25.2/lisp/org/org-plot
/home/thierry/.emacs.d/elpa/org-20170515/ob-C hides /usr/local/share/emacs/25.2/lisp/org/ob-C
/home/thierry/.emacs.d/elpa/org-20170515/org-clock hides /usr/local/share/emacs/25.2/lisp/org/org-clock
/home/thierry/.emacs.d/elpa/org-20170515/org-attach hides /usr/local/share/emacs/25.2/lisp/org/org-attach
/home/thierry/.emacs.d/elpa/org-20170515/ob-ruby hides /usr/local/share/emacs/25.2/lisp/org/ob-ruby
/home/thierry/.emacs.d/elpa/org-20170515/org-habit hides /usr/local/share/emacs/25.2/lisp/org/org-habit
/home/thierry/.emacs.d/elpa/org-20170515/org-eshell hides /usr/local/share/emacs/25.2/lisp/org/org-eshell
/home/thierry/.emacs.d/elpa/org-20170515/ob-ocaml hides /usr/local/share/emacs/25.2/lisp/org/ob-ocaml
/home/thierry/.emacs.d/elpa/org-20170515/ox-odt hides /usr/local/share/emacs/25.2/lisp/org/ox-odt
/home/thierry/.emacs.d/elpa/org-20170515/ob-exp hides /usr/local/share/emacs/25.2/lisp/org/ob-exp
/home/thierry/.emacs.d/elpa/org-20170515/ob-dot hides /usr/local/share/emacs/25.2/lisp/org/ob-dot
/home/thierry/.emacs.d/elpa/org-20170515/ob-scheme hides /usr/local/share/emacs/25.2/lisp/org/ob-scheme
/home/thierry/.emacs.d/elpa/org-20170515/ob-org hides /usr/local/share/emacs/25.2/lisp/org/ob-org
/home/thierry/.emacs.d/elpa/org-20170515/org-bibtex hides /usr/local/share/emacs/25.2/lisp/org/org-bibtex
/home/thierry/.emacs.d/elpa/org-20170515/org-compat hides /usr/local/share/emacs/25.2/lisp/org/org-compat
/home/thierry/.emacs.d/elpa/org-20170515/ox-icalendar hides /usr/local/share/emacs/25.2/lisp/org/ox-icalendar
/home/thierry/.emacs.d/elpa/org-20170515/org-colview hides /usr/local/share/emacs/25.2/lisp/org/org-colview
/home/thierry/.emacs.d/elpa/org-20170515/ob-picolisp hides /usr/local/share/emacs/25.2/lisp/org/ob-picolisp
/home/thierry/.emacs.d/elpa/org-20170515/org-mhe hides /usr/local/share/emacs/25.2/lisp/org/org-mhe
/home/thierry/.emacs.d/elpa/org-20170515/org-table hides /usr/local/share/emacs/25.2/lisp/org/org-table
/home/thierry/.emacs.d/elpa/org-20170515/ob-clojure hides /usr/local/share/emacs/25.2/lisp/org/ob-clojure
/home/thierry/.emacs.d/elpa/org-20170515/ob-tangle hides /usr/local/share/emacs/25.2/lisp/org/ob-tangle
/home/thierry/.emacs.d/elpa/org-20170515/ob-table hides /usr/local/share/emacs/25.2/lisp/org/ob-table
/home/thierry/.emacs.d/elpa/org-20170515/ob-asymptote hides /usr/local/share/emacs/25.2/lisp/org/ob-asymptote
/home/thierry/.emacs.d/elpa/org-20170515/org-ctags hides /usr/local/share/emacs/25.2/lisp/org/org-ctags
/home/thierry/.emacs.d/elpa/org-20170515/ob-screen hides /usr/local/share/emacs/25.2/lisp/org/ob-screen
/home/thierry/.emacs.d/elpa/org-20170515/org-protocol hides /usr/local/share/emacs/25.2/lisp/org/org-protocol
/home/thierry/.emacs.d/elpa/org-20170515/ob-js hides /usr/local/share/emacs/25.2/lisp/org/ob-js
/home/thierry/.emacs.d/elpa/org-20170515/ob-lob hides /usr/local/share/emacs/25.2/lisp/org/ob-lob
/home/thierry/.emacs.d/elpa/let-alist-1.0.5/let-alist hides /usr/local/share/emacs/25.2/lisp/emacs-lisp/let-alist
/home/thierry/.emacs.d/elpa/seq-2.20/seq hides /usr/local/share/emacs/25.2/lisp/emacs-lisp/seq

Features:
(shadow epa-mail face-remap emacsbug helm-command view tramp-cache
whitespace helm-ls-git vc vc-dispatcher tabify make-mode vc-filewise
vc-rcs ledger-config ledger vc-git naquadah-theme solar cal-dst holidays
hol-loaddefs em-unix em-term term disp-table ehelp em-script em-prompt
em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic em-banner
em-alias tv-utils log-view realgud realgud-zshdb
realgud:zshdb-track-mode realgud:zshdb-core realgud:zshdb-init
realgud-trepan3k realgud:trepan3k-track-mode realgud:trepan3k-core
realgud:trepan3k-init realgud-trepan2 realgud:trepan2-track-mode
realgud:trepan2-core realgud:trepan2-init python realgud-trepanpl
realgud:trepanpl-track-mode realgud:trepanpl-core realgud:trepanpl-init
realgud-trepanjs realgud:trepanjs-track-mode realgud:trepanjs-core
realgud:trepanjs-init realgud-trepan realgud:trepan-track-mode
realgud:trepan-core realgud:trepan-init realgud-remake
realgud:remake-track-mode realgud:remake-core realgud:remake-init
realgud-rdebug realgud-rdebug-track-mode realgud-rdebug-core
realgud-rdebug-init realgud-lang-ruby realgud-perldb
realgud:perldb-track-mode realgud:perldb-core realgud:perldb-init
realgud-lang-perl realgud-pdb realgud:pdb-track-mode realgud:pdb-core
realgud:pdb-init realgud-nodejs realgud:nodejs-track-mode
realgud:nodejs-core realgud:nodejs-init realgud-lang-js realgud-kshdb
realgud:kshdb-track-mode realgud:kshdb-core realgud:kshdb-init
realgud-jdb realgud:jdb-track-mode realgud:jdb-core realgud:jdb-init
realgud-lang-java gud realgud-ipdb realgud:ipdb-track-mode
realgud:ipdb-core realgud:ipdb-init realgud-lang-python realgud-gub
realgud:gub-track-mode realgud:gub-core realgud:gub-init realgud-gdb
realgud:gdb-track-mode realgud:gdb-init realgud:gdb-core realgud-bashdb
realgud:bashdb-track-mode realgud:bashdb-core realgud:bashdb-init
realgud-lang-posix-shell realgud:run realgud-track-mode
realgud-backtrace-mode realgud-track realgud-shortkey realgud-menu
realgud-eval realgud-cmds realgud-send realgud-window realgud-utils
realgud-init realgud-file realgud-core realgud-reset
realgud-buffer-helper realgud-buffer-backtrace realgud-buffer-command
realgud-buffer-info realgud-regexp realgud-lochist realgud-bp
realgud-bp-image-data realgud-loc realgud-buffer-source realgud-key key
realgud-follow realgud-lang realgud-fringe realgud-helper loc-changes
realgud-custom load-relative flycheck pcmpl-git NetworkManager dbus gh
gh-users gh-issues gh-pulls gh-repos gh-comments gh-gist gh-oauth gh-api
logito gh-cache pcache eieio-base gh-auth gh-url url-http tls gnutls
url-auth url-gw disable-mouse powerline powerline-separators color
powerline-themes windmove toc-org elp cl-indent esh-var esh-io esh-cmd
esh-opt esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode
esh-util markdown-mode addressbook-bookmark mu4e-config org-mu4e helm-mu
mu4e-contrib mu4e desktop frameset mu4e-speedbar speedbar sb-image
ezimage dframe mu4e-main mu4e-view epa derived mu4e-headers mu4e-compose
mu4e-context mu4e-draft mu4e-actions ido rfc2368 smtpmail sendmail
mu4e-mark mu4e-message flow-fill html2text mu4e-proc mu4e-proc-mu
mu4e-utils mu4e-lists mu4e-vars hl-line cl mu4e-meta config-w3m
w3m-search w3m doc-view subr-x jka-compr image-mode timezone w3m-hist
w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc
w3m-util git-gutter cus-edit wid-edit appt diary-lib diary-loaddefs
ange-ftp xdvi-search eldoc-eval undo-tree diff magit-obsolete
magit-blame magit-stash magit-bisect magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-branch magit-files
magit-refs magit-status magit magit-repos magit-apply magit-wip
magit-log magit-diff smerge-mode diff-mode magit-core magit-autorevert
autorevert filenotify magit-process magit-margin magit-mode magit-git
crm magit-section magit-popup git-commit magit-utils log-edit message
rfc822 mml mml-sec epg epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log with-editor tramp-sh server
pcomplete-extension pcmpl-unix pcmpl-gnu psession iterator iedit
iedit-lib dired-extension emms-vlc-config emms-librefm-stream
emms-librefm-scrobbler emms-playlist-limit emms-volume
emms-volume-amixer emms-i18n emms-history emms-score emms-stream-info
emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon
emms-browser sort emms-playlist-sort emms-last-played emms-player-xine
emms-player-mpd tq emms-playing-time emms-lyrics emms-url emms-streams
emms-show-all emms-tag-editor emms-mark emms-mode-line emms-cache
emms-info-ogginfo emms-info-mp3info emms-info later-do
emms-playlist-mode emms-player-vlc emms-player-mplayer
emms-player-simple emms-source-playlist emms-source-file locate
emms-setup emms emms-compat org-config-thierry ob-sh org-crypt
org-element avl-tree org-location-google-maps org-agenda google-maps
google-maps-static google-maps-geocode google-maps-base org org-macro
org-footnote org-pcomplete org-list org-faces org-entities noutline
outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob
ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs find-func cal-menu calendar cal-loaddefs dired-async
net-utils time winner w3m-wget wget wget-sysdep cmake-mode autotest-mode
autoconf-mode sh-script smie executable ps-print ps-def lpr rst
image-file savehist paren woman man ediff-merg ediff-wind ediff-diff
ediff-mult ediff-help ediff-init ediff-util ediff init-helm-thierry
helm-descbinds helm-sys popup helm-ring helm-elisp helm-eval edebug
helm-mode helm-files image-dired tramp tramp-compat tramp-loaddefs
trampver ucs-normalize shell pcomplete format-spec dired-x dired-aux
ffap thingatpt helm-buffers helm-tags helm-bookmark helm-adaptive
helm-info bookmark pp helm-locate helm-grep wgrep-helm wgrep grep
helm-regexp helm-external helm-net browse-url xml url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap helm-utils compile comint ansi-color ring helm-help
helm-types helm helm-source helm-multi-match helm-lib dired
helm-extensions-autoloads helm-config helm-autoloads helm-easymenu
async-bytecomp advice async mb-depth edmacro kmacro use-package diminish
bind-key easy-mmode finder-inf tex-site gh-common gh-profile url-parse
auth-source gnus-util mm-util help-fns mail-prsvr password-cache
url-vars rx s marshal cl-seq eieio-compat ht json map dash eieio
eieio-core cl-macs info package seq byte-opt gv bytecomp byte-compile
cl-extra help-mode easymenu cconv time-date avoid cus-start cus-load
cl-loaddefs pcase cl-lib 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 852624 255376)
 (symbols 48 63544 4)
 (miscs 40 1010 3307)
 (strings 32 203287 136597)
 (string-bytes 1 6279297)
 (vectors 16 102612)
 (vector-slots 8 2224110 91733)
 (floats 8 3203 2112)
 (intervals 56 14309 3236)
 (buffers 976 138)
 (heap 1024 94228 14737))

-- 
Thierry
Gpg Key fingerprint = 6CEC 7081 AB33 E251 4AB8  5FC2 28D1 7F53 59F2 9997





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-07  9:31 bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc Thierry Volpiatto
@ 2017-06-07 15:33 ` Eli Zaretskii
  2017-06-07 16:02   ` Thierry Volpiatto
  2017-06-07 16:15   ` Dmitry Gutov
  2017-06-10 16:15 ` Johan Bockgård
  1 sibling, 2 replies; 17+ messages in thread
From: Eli Zaretskii @ 2017-06-07 15:33 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 27272

> From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
> Date: Wed, 07 Jun 2017 11:31:28 +0200
> 
> 
> If no objections can I push this ?

Could you perhaps provide some more explanations for what problem you
are trying to solve and how?  The log message doesn't help in
understanding that (and also doesn't describe the actual changes, only
their general idea, so it seems).

Also, does any of this cause visible behavior changes?  If so, perhaps
a NEWS entry is in order.

Thanks.





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-07 15:33 ` Eli Zaretskii
@ 2017-06-07 16:02   ` Thierry Volpiatto
  2017-06-07 17:00     ` Eli Zaretskii
  2017-06-07 16:15   ` Dmitry Gutov
  1 sibling, 1 reply; 17+ messages in thread
From: Thierry Volpiatto @ 2017-06-07 16:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 27272


Eli Zaretskii <eliz@gnu.org> writes:

> Could you perhaps provide some more explanations for what problem you
> are trying to solve and how?

(cl-defun foo (prompt lst &key a b c))

(foo "prompt: " bar :b 2)

Try to move your cursor on the different args with and without patch applied.

Thanks.

-- 
Thierry
Gpg Key fingerprint = 6CEC 7081 AB33 E251 4AB8  5FC2 28D1 7F53 59F2 9997





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-07 15:33 ` Eli Zaretskii
  2017-06-07 16:02   ` Thierry Volpiatto
@ 2017-06-07 16:15   ` Dmitry Gutov
  1 sibling, 0 replies; 17+ messages in thread
From: Dmitry Gutov @ 2017-06-07 16:15 UTC (permalink / raw)
  To: Eli Zaretskii, Thierry Volpiatto; +Cc: 27272

On 6/7/17 6:33 PM, Eli Zaretskii wrote:

> Could you perhaps provide some more explanations for what problem you
> are trying to solve and how?  The log message doesn't help in
> understanding that (and also doesn't describe the actual changes, only
> their general idea, so it seems).

It would be great to have a test or two there, and that would take care 
of the explanation, probably.

> Also, does any of this cause visible behavior changes?  If so, perhaps
> a NEWS entry is in order.

I'm guessing it's purely a bugfix.





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-07 16:02   ` Thierry Volpiatto
@ 2017-06-07 17:00     ` Eli Zaretskii
       [not found]       ` <87shjbegwy.fsf@gmail.com>
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2017-06-07 17:00 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 27272

> From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
> Cc: 27272@debbugs.gnu.org
> Date: Wed, 07 Jun 2017 18:02:24 +0200
> 
> > Could you perhaps provide some more explanations for what problem you
> > are trying to solve and how?
> 
> (cl-defun foo (prompt lst &key a b c))
> 
> (foo "prompt: " bar :b 2)
> 
> Try to move your cursor on the different args with and without patch applied.

Could you please tell it in English?





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
       [not found]         ` <83fufb8avt.fsf@gnu.org>
@ 2017-06-08  8:17           ` Thierry Volpiatto
  2017-06-08 15:04             ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Thierry Volpiatto @ 2017-06-08  8:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 27272


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
>> Date: Wed, 07 Jun 2017 21:28:29 +0200
>> 
>> >> Try to move your cursor on the different args with and without patch applied.
>> >
>> > Could you please tell it in English?
>> 
>> No I can't sorry.
>
> Then I don't see how I can approve your patch.  Maybe you can ask
> someone else to explain the issue.

Perhaps I have also other things to do than loosing my time on this
mailing list.

So ignore the patch and consider this bugreport:

    Eldoc is highlighting wrongly positional arguments when they are mixed
    with keyword arguments.

Then if you feel it is a bug, fix it (or not) otherwise close this
bugreport.

Thanks.

BTW I am the original author of the code I was trying to patch, nevermind.

-- 
Thierry
Gpg Key fingerprint = 6CEC 7081 AB33 E251 4AB8  5FC2 28D1 7F53 59F2 9997





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-08  8:17           ` Thierry Volpiatto
@ 2017-06-08 15:04             ` Eli Zaretskii
  0 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2017-06-08 15:04 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 27272

> From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
> Cc: 27272@debbugs.gnu.org
> Date: Thu, 08 Jun 2017 10:17:36 +0200
> 
> >> >> Try to move your cursor on the different args with and without patch applied.
> >> >
> >> > Could you please tell it in English?
> >> 
> >> No I can't sorry.
> >
> > Then I don't see how I can approve your patch.  Maybe you can ask
> > someone else to explain the issue.
> 
> Perhaps I have also other things to do than loosing my time on this
> mailing list.
> 
> So ignore the patch and consider this bugreport:
> 
>     Eldoc is highlighting wrongly positional arguments when they are mixed
>     with keyword arguments.
> 
> Then if you feel it is a bug, fix it (or not) otherwise close this
> bugreport.
> 
> Thanks.
> 
> BTW I am the original author of the code I was trying to patch, nevermind.

Oh, my.  I feel there's some gigantic misunderstanding here, most
probably due to my wording.  Sorry about that.  Let me try again.

Could you please elaborate on the incorrect behavior in the example
you provided?  You wrote:

> (cl-defun foo (prompt lst &key a b c))
> 
> (foo "prompt: " bar :b 2)
> 
> Try to move your cursor on the different args with and without patch applied.

Can you please point out which positional arguments are wrongly
highlighted, and in which one of these two lines?





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-07  9:31 bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc Thierry Volpiatto
  2017-06-07 15:33 ` Eli Zaretskii
@ 2017-06-10 16:15 ` Johan Bockgård
  2017-06-11  8:08   ` Thierry Volpiatto
  1 sibling, 1 reply; 17+ messages in thread
From: Johan Bockgård @ 2017-06-10 16:15 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 27272

Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:

> Fix eldoc with positional arg among keyword args.
>
> * lisp/progmodes/elisp-mode.el (elisp--highlight-function-argument):
> Switch to indexed arg searching when no keyword found behind arg.

This code is wrong both with and without your fix. All mandatory and
optional arguments should be used *before* keywords are matched.

Given this definition of `foo',

    (cl-defun foo (x &key a b c)
      (list x a b c))

`:b' in the following call specifies the positional argument `x', not
the keyword argument `b':

    (foo :b :a 1)  =>  (:b 1 nil nil)





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-10 16:15 ` Johan Bockgård
@ 2017-06-11  8:08   ` Thierry Volpiatto
  2017-06-15  0:05     ` npostavs
  0 siblings, 1 reply; 17+ messages in thread
From: Thierry Volpiatto @ 2017-06-11  8:08 UTC (permalink / raw)
  To: Johan Bockgård; +Cc: 27272


Johan Bockgård <bojohan@gnu.org> writes:

> Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
>
>> Fix eldoc with positional arg among keyword args.
>>
>> * lisp/progmodes/elisp-mode.el (elisp--highlight-function-argument):
>> Switch to indexed arg searching when no keyword found behind arg.
>
> This code is wrong both with and without your fix. All mandatory and
> optional arguments should be used *before* keywords are matched.
>
> Given this definition of `foo',
>
>     (cl-defun foo (x &key a b c)
>       (list x a b c))
>
> `:b' in the following call specifies the positional argument `x', not
> the keyword argument `b':
>
>     (foo :b :a 1)  =>  (:b 1 nil nil)

Fixed as well.

Thanks.

-- 
Thierry
Gpg Key fingerprint = 6CEC 7081 AB33 E251 4AB8  5FC2 28D1 7F53 59F2 9997





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-11  8:08   ` Thierry Volpiatto
@ 2017-06-15  0:05     ` npostavs
  2017-06-15  3:26       ` Thierry Volpiatto
  0 siblings, 1 reply; 17+ messages in thread
From: npostavs @ 2017-06-15  0:05 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 27272, Johan Bockgård

Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:

> Johan Bockgård <bojohan@gnu.org> writes:
>
>> Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
>>
>>> Fix eldoc with positional arg among keyword args.
>>>
>>> * lisp/progmodes/elisp-mode.el (elisp--highlight-function-argument):
>>> Switch to indexed arg searching when no keyword found behind arg.
>>
>> This code is wrong both with and without your fix. All mandatory and
>> optional arguments should be used *before* keywords are matched.
>>
>> Given this definition of `foo',
>>
>>     (cl-defun foo (x &key a b c)
>>       (list x a b c))
>>
>> `:b' in the following call specifies the positional argument `x', not
>> the keyword argument `b':
>>
>>     (foo :b :a 1)  =>  (:b 1 nil nil)
>
> Fixed as well.

Do you mean you have an updated patch that fixes this as well (which you
seem to have forgotten to post)?





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-15  0:05     ` npostavs
@ 2017-06-15  3:26       ` Thierry Volpiatto
  2017-06-30  4:01         ` npostavs
  0 siblings, 1 reply; 17+ messages in thread
From: Thierry Volpiatto @ 2017-06-15  3:26 UTC (permalink / raw)
  To: npostavs; +Cc: 27272, Johan Bockgård


npostavs@users.sourceforge.net writes:

> Do you mean you have an updated patch that fixes this as well (which you
> seem to have forgotten to post)?

It is here.


diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index b3f452ca5b9..b2b3015581d 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1400,7 +1400,8 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
         (args-lst (mapcar (lambda (x)
                             (replace-regexp-in-string
                              "\\`[(]\\|[)]\\'" "" x))
-                          (split-string args))))
+                          (split-string args)))
+        (start-key-pos (cl-position "&key" args-lst :test 'equal)))
     ;; Find the current argument in the argument string.  We need to
     ;; handle `&rest' and informal `...' properly.
     ;;
@@ -1412,11 +1413,12 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
     ;; When `&key' is used finding position based on `index'
     ;; would be wrong, so find the arg at point and determine
     ;; position in ARGS based on this current arg.
-    (when (string-match "&key" args)
+    (when (and (string-match "&key" args)
+               (> index start-key-pos))
       (let* (case-fold-search
              key-have-value
              (sym-name (symbol-name sym))
-             (cur-w (current-word))
+             (cur-w (current-word t))
              (args-lst-ak (cdr (member "&key" args-lst)))
              (limit (save-excursion
                       (when (re-search-backward sym-name nil t)
@@ -1425,7 +1427,7 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
                         (substring cur-w 1)
                       (save-excursion
                         (let (split)
-                          (when (re-search-backward ":\\([^()\n]*\\)" limit t)
+                          (when (re-search-backward ":\\([^ ()\n]*\\)" limit t)
                             (setq split (split-string (match-string 1) " " t))
                             (prog1 (car split)
                               (when (cdr split)
@@ -1437,7 +1439,7 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
                                  args-lst-ak
                                  (not (member (upcase cur-a) args-lst-ak))
                                  (upcase (car (last args-lst-ak))))))
-        (unless (string= cur-w sym-name)
+        (unless (or (null cur-w) (string= cur-w sym-name))
           ;; The last keyword have already a value
           ;; i.e :foo a b and cursor is at b.
           ;; If signature have also `&rest'


-- 
Thierry
Gpg Key fingerprint = 6CEC 7081 AB33 E251 4AB8  5FC2 28D1 7F53 59F2 9997





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-15  3:26       ` Thierry Volpiatto
@ 2017-06-30  4:01         ` npostavs
  2017-06-30  6:36           ` Thierry Volpiatto
  0 siblings, 1 reply; 17+ messages in thread
From: npostavs @ 2017-06-30  4:01 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 27272, Johan Bockgård

Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:

> npostavs@users.sourceforge.net writes:
>
>> Do you mean you have an updated patch that fixes this as well (which you
>> seem to have forgotten to post)?
>
> It is here.

I get a compile warning

In elisp--highlight-function-argument:
../../emacs-master/lisp/progmodes/elisp-mode.el:1404:44:Warning: reference to
    free variable ‘args-lst’

and then at run-time eldoc is non-functional, it just prints

eldoc error: (void-variable args-lst)





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-30  4:01         ` npostavs
@ 2017-06-30  6:36           ` Thierry Volpiatto
  2017-07-01 21:00             ` Noam Postavsky
  0 siblings, 1 reply; 17+ messages in thread
From: Thierry Volpiatto @ 2017-06-30  6:36 UTC (permalink / raw)
  To: npostavs; +Cc: 27272, Johan Bockgård


npostavs@users.sourceforge.net writes:

> Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
>
>> npostavs@users.sourceforge.net writes:
>>
>>> Do you mean you have an updated patch that fixes this as well (which you
>>> seem to have forgotten to post)?
>>
>> It is here.
>
> I get a compile warning
>
> In elisp--highlight-function-argument:
> ../../emacs-master/lisp/progmodes/elisp-mode.el:1404:44:Warning: reference to
>     free variable ‘args-lst’
>
> and then at run-time eldoc is non-functional, it just prints
>
> eldoc error: (void-variable args-lst)

This patch is an adaptation of what I use in my .emacs.el, originally
the patch was correct, I have then deleted it (because the patch was
refused) and then created it again on your request, forgetting to merge
one line; Use let* instead of let.

Don't expect me to send another patch for such trivial change and more
generally to collaborate anymore on any emacs bugs.

--
Thierry
Gpg Key fingerprint = 6CEC 7081 AB33 E251 4AB8  5FC2 28D1 7F53 59F2 9997





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-06-30  6:36           ` Thierry Volpiatto
@ 2017-07-01 21:00             ` Noam Postavsky
  2017-07-20  2:22               ` npostavs
  0 siblings, 1 reply; 17+ messages in thread
From: Noam Postavsky @ 2017-07-01 21:00 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 27272, Johan Bockgård

On Fri, Jun 30, 2017 at 2:36 AM, Thierry Volpiatto
<thierry.volpiatto@gmail.com> wrote:
>
> This patch is an adaptation of what I use in my .emacs.el, originally
> the patch was correct, I have then deleted it (because the patch was
> refused) and then created it again on your request, forgetting to merge
> one line; Use let* instead of let.

Thanks, we will have to test the patch to make sure it works since it
hasn't been tested in isolation then.

> Don't expect me to send another patch for such trivial change and more
> generally to collaborate anymore on any emacs bugs.

Yes, I noticed throughout this thread you have been avoiding any
effort beyond posting your patch but I don't understand why. Are you
angry about something?





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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-07-01 21:00             ` Noam Postavsky
@ 2017-07-20  2:22               ` npostavs
  2017-08-05  1:35                 ` npostavs
  0 siblings, 1 reply; 17+ messages in thread
From: npostavs @ 2017-07-20  2:22 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 27272, Johan Bockgård

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

Noam Postavsky <npostavs@users.sourceforge.net> writes:

> On Fri, Jun 30, 2017 at 2:36 AM, Thierry Volpiatto
> <thierry.volpiatto@gmail.com> wrote:
>>
>> This patch is an adaptation of what I use in my .emacs.el, originally
>> the patch was correct, I have then deleted it (because the patch was
>> refused) and then created it again on your request, forgetting to merge
>> one line; Use let* instead of let.
>
> Thanks, we will have to test the patch to make sure it works since it
> hasn't been tested in isolation then.

I've added a commit message and tests, I will push in a few days if there
are no objections.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3767 bytes --]

From 27ddcf55804d4e852b2572ec4b7cab7dacecc5d6 Mon Sep 17 00:00:00 2001
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
Date: Thu, 15 Jun 2017 05:26:05 +0200
Subject: [PATCH v3 1/2] Fix eldoc highlighting for &key args (Bug#27272)

* lisp/progmodes/elisp-mode.el (elisp--highlight-function-argument):
Only switch to keyword-based searching if INDEX is greater than the
index of `&key' in the argument list.  All arguments prior to the
`&key' are position based.  Additionally, be more strict about what is
a keyword when searching for the current keyword.
---
 lisp/progmodes/elisp-mode.el | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index b3f452ca5b..c70d5baffe 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1394,13 +1394,14 @@ (defun elisp--highlight-function-argument (sym args index prefix)
   ;; FIXME: This should probably work on the list representation of `args'
   ;; rather than its string representation.
   ;; FIXME: This function is much too long, we need to split it up!
-  (let ((start          nil)
-	(end            0)
-	(argument-face  'eldoc-highlight-function-argument)
-        (args-lst (mapcar (lambda (x)
-                            (replace-regexp-in-string
-                             "\\`[(]\\|[)]\\'" "" x))
-                          (split-string args))))
+  (let* ((start          nil)
+         (end            0)
+         (argument-face  'eldoc-highlight-function-argument)
+         (args-lst (mapcar (lambda (x)
+                             (replace-regexp-in-string
+                              "\\`[(]\\|[)]\\'" "" x))
+                           (split-string args)))
+         (start-key-pos (cl-position "&key" args-lst :test 'equal)))
     ;; Find the current argument in the argument string.  We need to
     ;; handle `&rest' and informal `...' properly.
     ;;
@@ -1412,11 +1413,12 @@ (defun elisp--highlight-function-argument (sym args index prefix)
     ;; When `&key' is used finding position based on `index'
     ;; would be wrong, so find the arg at point and determine
     ;; position in ARGS based on this current arg.
-    (when (string-match "&key" args)
+    (when (and start-key-pos
+               (> index start-key-pos))
       (let* (case-fold-search
              key-have-value
              (sym-name (symbol-name sym))
-             (cur-w (current-word))
+             (cur-w (current-word t))
              (args-lst-ak (cdr (member "&key" args-lst)))
              (limit (save-excursion
                       (when (re-search-backward sym-name nil t)
@@ -1425,7 +1427,7 @@ (defun elisp--highlight-function-argument (sym args index prefix)
                         (substring cur-w 1)
                       (save-excursion
                         (let (split)
-                          (when (re-search-backward ":\\([^()\n]*\\)" limit t)
+                          (when (re-search-backward ":\\([^ ()\n]*\\)" limit t)
                             (setq split (split-string (match-string 1) " " t))
                             (prog1 (car split)
                               (when (cdr split)
@@ -1437,7 +1439,7 @@ (defun elisp--highlight-function-argument (sym args index prefix)
                                  args-lst-ak
                                  (not (member (upcase cur-a) args-lst-ak))
                                  (upcase (car (last args-lst-ak))))))
-        (unless (string= cur-w sym-name)
+        (unless (or (null cur-w) (string= cur-w sym-name))
           ;; The last keyword have already a value
           ;; i.e :foo a b and cursor is at b.
           ;; If signature have also `&rest'
-- 
2.11.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch --]
[-- Type: text/x-diff, Size: 3399 bytes --]

From 2e15fa20c441d5ead95a416e7fd67c525bc5fbaf Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Wed, 19 Jul 2017 22:06:02 -0400
Subject: [PATCH v3 2/2] Add tests for previous commit

* test/lisp/progmodes/elisp-mode-tests.el
(elisp-mode-tests--face-propertized-string): New function.
(elisp--highlight-function-argument-indexed)
(elisp--highlight-function-argument-keyed-1)
(elisp--highlight-function-argument-keyed-2): New tests.
---
 test/lisp/progmodes/elisp-mode-tests.el | 56 +++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el
index ee0837f2c4..675aa31a79 100644
--- a/test/lisp/progmodes/elisp-mode-tests.el
+++ b/test/lisp/progmodes/elisp-mode-tests.el
@@ -24,6 +24,7 @@
 
 (require 'ert)
 (require 'xref)
+(eval-when-compile (require 'cl-lib))
 
 ;;; Completion
 
@@ -180,6 +181,61 @@ (ert-deftest eval-last-sexp-print-format-large-int-echo ()
         (call-interactively #'eval-last-sexp)
         (should (equal (current-message) "66 (#o102, #x42, ?B)"))))))
 
+;;; eldoc
+
+(defun elisp-mode-tests--face-propertized-string (string)
+  "Return substring of STRING with a non-nil `face' property."
+  (let* ((start (next-single-property-change 0 'face string))
+         (end (and start (next-single-property-change start 'face string))))
+    (and end
+         (substring string start end))))
+
+(ert-deftest elisp--highlight-function-argument-indexed ()
+  (dotimes (i 3)
+    (should
+     (equal (elisp-mode-tests--face-propertized-string
+             (elisp--highlight-function-argument 'foo "(A B C)" (1+ i) "foo: "))
+            (propertize (nth i '("A" "B" "C"))
+                        'face 'eldoc-highlight-function-argument)))))
+
+(ert-deftest elisp--highlight-function-argument-keyed-1 ()
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "(foo prompt bar :b 2)")
+    (goto-char (1+ (point-min)))
+    (cl-flet ((bold-arg (i)
+               (elisp-mode-tests--face-propertized-string
+                (elisp--highlight-function-argument
+                 'foo "(PROMPT LST &key A B C)" i "foo: "))))
+      (should-not (bold-arg 0))
+      (progn (forward-sexp) (forward-char))
+      (should (equal (bold-arg 1) "PROMPT"))
+      (progn (forward-sexp) (forward-char))
+      (should (equal (bold-arg 2) "LST"))
+      ;; Both `:b' and `2' should highlight the `B' arg.
+      (progn (forward-sexp) (forward-char))
+      (should (equal (bold-arg 3) "B"))
+      (progn (forward-sexp) (forward-char))
+      (should (equal (bold-arg 4) "B")))))
+
+(ert-deftest elisp--highlight-function-argument-keyed-2 ()
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "(foo :b :a 1)")
+    (goto-char (1+ (point-min)))
+    (cl-flet ((bold-arg (i)
+               (elisp-mode-tests--face-propertized-string
+                (elisp--highlight-function-argument
+                 'foo "(X &key A B C)" i "foo: "))))
+      (should-not (bold-arg 0))
+      ;; The `:b' specifies positional arg `X'.
+      (progn (forward-sexp) (forward-char))
+      (should (equal (bold-arg 1) "X"))
+      (progn (forward-sexp) (forward-char))
+      (should (equal (bold-arg 2) "A"))
+      (progn (forward-sexp) (forward-char))
+      (should (equal (bold-arg 3) "A")))))
+
 ;;; xref
 
 (defun xref-elisp-test-descr-to-target (xref)
-- 
2.11.1


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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-07-20  2:22               ` npostavs
@ 2017-08-05  1:35                 ` npostavs
  2017-08-16  1:30                   ` npostavs
  0 siblings, 1 reply; 17+ messages in thread
From: npostavs @ 2017-08-05  1:35 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 27272, Johan Bockgård

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

npostavs@users.sourceforge.net writes:

> Noam Postavsky <npostavs@users.sourceforge.net> writes:

>> Thanks, we will have to test the patch to make sure it works since it
>> hasn't been tested in isolation then.
>
> I've added a commit message and tests, I will push in a few days if there
> are no objections.

Actually, I found another little problem: it uses `cl-position' without
requiring `cl-lib', so it triggers void-function errors in the *scratch*
buffer from 'emacs -Q'.  Here's a new version that uses `member' instead
of `cl-position'.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3804 bytes --]

From b6861be04246d29ea46cf4130700df4d923fac58 Mon Sep 17 00:00:00 2001
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
Date: Thu, 15 Jun 2017 05:26:05 +0200
Subject: [PATCH v4] Fix eldoc highlighting for &key args (Bug#27272)

* lisp/progmodes/elisp-mode.el (elisp--highlight-function-argument):
Only switch to keyword-based searching if INDEX point beyond `&key' in
the argument list.  All arguments prior to the `&key' are position
based.  Additionally, be more strict about what is a keyword when
searching for the current keyword.
---
 lisp/progmodes/elisp-mode.el | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index b3f452ca5b..47739f5957 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1394,13 +1394,14 @@ (defun elisp--highlight-function-argument (sym args index prefix)
   ;; FIXME: This should probably work on the list representation of `args'
   ;; rather than its string representation.
   ;; FIXME: This function is much too long, we need to split it up!
-  (let ((start          nil)
-	(end            0)
-	(argument-face  'eldoc-highlight-function-argument)
-        (args-lst (mapcar (lambda (x)
-                            (replace-regexp-in-string
-                             "\\`[(]\\|[)]\\'" "" x))
-                          (split-string args))))
+  (let* ((start          nil)
+         (end            0)
+         (argument-face  'eldoc-highlight-function-argument)
+         (args-lst (mapcar (lambda (x)
+                             (replace-regexp-in-string
+                              "\\`[(]\\|[)]\\'" "" x))
+                           (split-string args)))
+         (args-lst-ak (cdr (member "&key" args-lst))))
     ;; Find the current argument in the argument string.  We need to
     ;; handle `&rest' and informal `...' properly.
     ;;
@@ -1412,12 +1413,12 @@ (defun elisp--highlight-function-argument (sym args index prefix)
     ;; When `&key' is used finding position based on `index'
     ;; would be wrong, so find the arg at point and determine
     ;; position in ARGS based on this current arg.
-    (when (string-match "&key" args)
+    (when (and args-lst-ak
+               (>= index (- (length args-lst) (length args-lst-ak))))
       (let* (case-fold-search
              key-have-value
              (sym-name (symbol-name sym))
-             (cur-w (current-word))
-             (args-lst-ak (cdr (member "&key" args-lst)))
+             (cur-w (current-word t))
              (limit (save-excursion
                       (when (re-search-backward sym-name nil t)
                         (match-end 0))))
@@ -1425,7 +1426,7 @@ (defun elisp--highlight-function-argument (sym args index prefix)
                         (substring cur-w 1)
                       (save-excursion
                         (let (split)
-                          (when (re-search-backward ":\\([^()\n]*\\)" limit t)
+                          (when (re-search-backward ":\\([^ ()\n]*\\)" limit t)
                             (setq split (split-string (match-string 1) " " t))
                             (prog1 (car split)
                               (when (cdr split)
@@ -1437,7 +1438,7 @@ (defun elisp--highlight-function-argument (sym args index prefix)
                                  args-lst-ak
                                  (not (member (upcase cur-a) args-lst-ak))
                                  (upcase (car (last args-lst-ak))))))
-        (unless (string= cur-w sym-name)
+        (unless (or (null cur-w) (string= cur-w sym-name))
           ;; The last keyword have already a value
           ;; i.e :foo a b and cursor is at b.
           ;; If signature have also `&rest'
-- 
2.11.1


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

* bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc.
  2017-08-05  1:35                 ` npostavs
@ 2017-08-16  1:30                   ` npostavs
  0 siblings, 0 replies; 17+ messages in thread
From: npostavs @ 2017-08-16  1:30 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 27272, Johan Bockgård

tags 27272 fixed
close 27272 26.1
quit

>> I've added a commit message and tests, I will push in a few days if there
>> are no objections.
>
> Actually, I found another little problem: it uses `cl-position' without
> requiring `cl-lib', so it triggers void-function errors in the *scratch*
> buffer from 'emacs -Q'.  Here's a new version that uses `member' instead
> of `cl-position'.

Pushed to master.

[1: 55c9238189]: 2017-08-15 21:22:41 -0400
  Fix eldoc highlighting for &key args (Bug#27272)
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=55c9238189795448075e2d4af93a7b29a505f23c

[2: 3305dec538]: 2017-08-15 21:22:41 -0400
  Add tests for previous commit
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3305dec5387021791eb09a93df5ab784b2297dc8





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

end of thread, other threads:[~2017-08-16  1:30 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-07  9:31 bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc Thierry Volpiatto
2017-06-07 15:33 ` Eli Zaretskii
2017-06-07 16:02   ` Thierry Volpiatto
2017-06-07 17:00     ` Eli Zaretskii
     [not found]       ` <87shjbegwy.fsf@gmail.com>
     [not found]         ` <83fufb8avt.fsf@gnu.org>
2017-06-08  8:17           ` Thierry Volpiatto
2017-06-08 15:04             ` Eli Zaretskii
2017-06-07 16:15   ` Dmitry Gutov
2017-06-10 16:15 ` Johan Bockgård
2017-06-11  8:08   ` Thierry Volpiatto
2017-06-15  0:05     ` npostavs
2017-06-15  3:26       ` Thierry Volpiatto
2017-06-30  4:01         ` npostavs
2017-06-30  6:36           ` Thierry Volpiatto
2017-07-01 21:00             ` Noam Postavsky
2017-07-20  2:22               ` npostavs
2017-08-05  1:35                 ` npostavs
2017-08-16  1:30                   ` npostavs

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).