From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#18048: 24.3.92; [patch] eldoc improvements Date: Fri, 18 Jul 2014 07:46:26 +0200 Message-ID: <87egxjxkxh.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1405663528 6978 80.91.229.3 (18 Jul 2014 06:05:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 18 Jul 2014 06:05:28 +0000 (UTC) To: 18048@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 18 08:05:21 2014 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 1X81IF-0005L2-8u for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Jul 2014 08:05:19 +0200 Original-Received: from localhost ([::1]:48154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X81IE-0001oV-Rh for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Jul 2014 02:05:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X81I5-0001lv-9y for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2014 02:05:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X81Hz-0000ew-78 for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2014 02:05:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X81Hz-0000ea-3C for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2014 02:05:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X81Hy-0001YP-Hb for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2014 02:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Jul 2014 06:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18048 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14056634675920 (code B ref -1); Fri, 18 Jul 2014 06:05:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Jul 2014 06:04:27 +0000 Original-Received: from localhost ([127.0.0.1]:57839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X81HN-0001XM-KK for submit@debbugs.gnu.org; Fri, 18 Jul 2014 02:04:26 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50636) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X81HL-0001X9-DT for submit@debbugs.gnu.org; Fri, 18 Jul 2014 02:04:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X81HA-0000WH-BE for submit@debbugs.gnu.org; Fri, 18 Jul 2014 02:04:18 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X81HA-0000WD-8m for submit@debbugs.gnu.org; Fri, 18 Jul 2014 02:04:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X81H4-0001Re-5I for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2014 02:04:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X81Gy-0000Tv-2G for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2014 02:04:06 -0400 Original-Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:46825) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X81Gx-0000Tc-OC for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2014 02:04:00 -0400 Original-Received: by mail-wi0-f179.google.com with SMTP id f8so248269wiw.6 for ; Thu, 17 Jul 2014 23:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=YRWcTfRfhWNGz7BaAUaTGK3DAHHSJA0WIKggnG9J+ME=; b=nBi4OJ/1BNsqZMeOUV1iEoPtwtsfMcbuF2qEmIIY4Fn60LWLkNFJAvrbYEueIPsMj4 alC+fY+o2LIjtv53FArRBqN2V8OHOb4/ihiEs5qyUWVQsleB5M7um58ZptSBCgbSO9Ga FF0kf1keHFOxLQdVDjNIITPYYkx/LqLNAPLx1sVMniKHCRR6ZBJGMUeVrUlXubcK4f0U pwjMiIxmo1d3bbezJfGiXo+rAgd/eWMqvtjZfRAwXU4f5kM1c6yLUUbe7DwWfOFwhKZh 0KoCDsxCVXdHgIOheuH8fOMLPIoLuRKobi1qx2Zmm3BJriNzBU0n/f82C9rcgTSJ60Qg auAQ== X-Received: by 10.194.238.231 with SMTP id vn7mr2832189wjc.99.1405663438310; Thu, 17 Jul 2014 23:03:58 -0700 (PDT) Original-Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPSA id r9sm2838716wia.17.2014.07.17.23.03.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 17 Jul 2014 23:03:57 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91621 Archived-At: Here a little patch that add two improvements to eldoc: 1) Allow adding manually informations to a symbol for eldoc: When a symbol use (&rest args), we want sometimes more meaningful infos on ARGS, this can be added with `put'. e.g (defun foo (&rest args) "Eval each ARG in ARGS like setq" [...]) (put 'foo 'eldoc "([VAR VALUE]...)") Now when I use `foo' function I have in eldoc: (foo ([VAR VALUE]...)) 2) Better handling of "..." in eldoc highlighting: Actually when using `setq', highlighting is correct when setting one symbol: (setq foo 1) When cursor is on foo we have in eldoc: (setq ([SYM VAL]...)) ^^^^ And when cursor is on 1 (setq ([SYM VAL]...)) ^^^^^^^ When setting more than one symbol e.g (setq foo 1 bar 2) After 1 eldoc highlighting stay on second arg: (setq ([SYM VAL]...)) ^^^^^^^ With this patch highlighting come back on first arg (SYM) diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index c64ec52..19962d5 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -349,8 +349,9 @@ or elsewhere, return a 1-line docstring. Calls the functions former calls `eldoc-argument-case'; the latter gives the function name `font-lock-function-name-face', and optionally highlights argument number INDEX." - (let (args doc advertised) - (cond ((not (and sym (symbolp sym) (fboundp sym)))) + (let (args doc advertised (prop (get sym 'eldoc))) + (cond (prop (setq doc prop)) + ((not (and sym (symbolp sym) (fboundp sym)))) ((and (eq sym (aref eldoc-last-data 0)) (eq 'function (aref eldoc-last-data 2))) (setq doc (aref eldoc-last-data 1))) @@ -400,7 +401,9 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'." ;; All the rest arguments are the same. (setq index 1)) ((string= argument "&optional")) - ((string-match-p "\\.\\.\\.$" argument) + ((or (string-match-p "\\.\\.\\.$" argument) + (and (string-match-p "\\.\\.\\.)?$" args) + (> index 1) (oddp index))) (setq index 0)) (t (setq index (1- index)))))) In GNU Emacs 24.3.92.6 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of 2014-07-15 on dell-14z Windowing system distributor `The X.Org Foundation', version 11.0.11501000 System Description: Ubuntu 14.04 LTS Configured using: `configure --without-toolkit-scroll-bars --without-gconf --without-gsettings' Important settings: value of $LANG: fr_FR.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: psession-mode: t golden-ratio-mode: t winner-mode: t global-undo-tree-mode: t undo-tree-mode: t auto-image-file-mode: t eldoc-in-minibuffer-mode: t show-paren-mode: t display-time-mode: t recentf-mode: t savehist-mode: t eldoc-mode: t minibuffer-depth-indicate-mode: t helm-mode: t helm-descbinds-mode: t shell-dirtrack-mode: t helm-adaptive-mode: t helm-match-plugin-mode: t helm-occur-match-plugin-mode: t tooltip-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 input: s c M-e SPC 3 M-x r e p o r t Recent messages: Restoring buffers...78% Setting up indent for shell type bash Indentation variables are now local. Indentation setup for shell type bash Setting up indent for shell type sh Indentation variables are now local. Indentation setup for shell type sh Restoring buffers...done "([VAR VALUE]...)" Auto-saving... Load-path shadows: ~/elisp/auctex/lpath hides ~/elisp/emacs-wget/lpath /usr/local/share/emacs/24.3.92/lisp/emacs-lisp/tq hides ~/elisp/emms/lisp/tq Features: (shadow epa-mail mule-util emacsbug helm-command cc-langs rst markdown-mode sh-script smie executable make-mode vc-rcs js json moz imenu cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs vc-git naquadah-theme em-unix em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic em-banner em-alias align-let git-gutter server psession golden-ratio winner undo-tree diff slime-xref-browser slime-banner slime-tramp slime-asdf slime-fancy slime-trace-dialog slime-fontifying-fu slime-package-fu slime-references slime-compiler-notes-tree slime-scratch slime-presentations bridge slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc slime-repl elp slime-parse slime gud apropos etags arc-mode archive-mode hyperspec image-file xdvi-search preview-latex tex-site auto-loads pcomplete-extension pcmpl-unix pcmpl-gnu em-term term disp-table ehelp helm-ipython helm-elisp helm-eval python eldoc-eval warnings whitespace paren time recentf tree-widget savehist mu4e-config org-mu4e helm-mu mu4e-contrib mu4e mu4e-speedbar speedbar sb-image ezimage dframe mu4e-main mu4e-view mu4e-headers mu4e-compose mu4e-draft mu4e-actions ido rfc2368 mu4e-mark mu4e-message html2text mu4e-proc mu4e-utils mu4e-lists mu4e-about mu4e-vars mu4e-meta gnus-dired nnir gnus-sum gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range gnus-win nnoo config-w3m w3m-search w3m doc-view jka-compr image-mode timezone w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util w3m-load smtpmail-async smtpmail sendmail dired-async iterator lacarte iedit-rect iedit iedit-lib smallurl mm-url gnus gnus-ems nnheader wid-edit rectangle-utils rect ledger-config ledger esh-var esh-io esh-cmd esh-opt esh-ext esh-proc eldoc esh-groups eshell esh-module esh-mode esh-arg esh-util tv-utils async pcvs vc-cvs pcvs-parse pcvs-info pcvs-defs pcvs-util ewoc mb-depth cl-info slime-autoloads esh-toggle flymake no-word htmlize cl dired-extension emms-mpd-config 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 hl-line emms-tag-editor emms-mark emms-mode-line emms-cache emms-info-ogginfo emms-info-mp3info emms-playlist-mode emms-player-vlc emms-player-mplayer emms-info emms-streams later-do emms-source-playlist emms-source-file emms-player-simple emms-setup emms emms-compat org-config-thierry ob-sh org-crypt cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs appt diary-lib diary-loaddefs org-annotation-helper addressbook-bookmark message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader firefox-protocol bookmark-firefox-handler bookmark-extensions org org-macro org-footnote org-pcomplete org-list org-faces org-entities noutline outline easy-mmode 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 init-helm-thierry helm-mode helm-dictionary helm-ls-git helm-descbinds helm-ls-hg helm-files image-dired tramp tramp-compat tramp-loaddefs trampver shell pcomplete format-spec dired-x dired-aux ffap thingatpt helm-buffers helm-elscreen helm-tags helm-bookmark helm-adaptive helm-info helm-net browse-url xml url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse url-vars mailcap helm-plugin bookmark pp helm-help helm-match-plugin helm-grep wgrep-helm wgrep helm-regexp grep helm-external helm-utils dired compile comint ansi-color ring helm-locate helm cl-macs gv vc vc-dispatcher helm-config helm-aliases epa-file epa derived epg epg-config auth-source eieio byte-opt bytecomp byte-compile cconv eieio-core gnus-util mm-util mail-prsvr password-cache package time-date avoid cus-start cus-load w3m-wget info easymenu edmacro kmacro advice help-fns net-utils cl-loaddefs cl-lib tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer 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 make-network-process dbusbind gfilenotify dynamic-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 536201 35503) (symbols 48 56357 9) (miscs 40 627 671) (strings 32 139699 18835) (string-bytes 1 4218847) (vectors 16 49691) (vector-slots 8 885428 24463) (floats 8 2130 170) (intervals 56 2486 0) (buffers 960 108) (heap 1024 42632 3181)) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997