From unknown Sun Jun 22 22:45:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27501: 24.5; hippie-expand-only-buffers not considered when buffer-local in 'try-expand-dabbrev-all-buffers Resent-From: Tom Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Jun 2017 16:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27501 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 27501@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14984941188443 (code B ref -1); Mon, 26 Jun 2017 16:22:01 +0000 Received: (at submit) by debbugs.gnu.org; 26 Jun 2017 16:21:58 +0000 Received: from localhost ([127.0.0.1]:39331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPWly-0002C7-83 for submit@debbugs.gnu.org; Mon, 26 Jun 2017 12:21:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58416) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPRw5-0007yN-E7 for submit@debbugs.gnu.org; Mon, 26 Jun 2017 07:12:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPRvy-0001GJ-PX for submit@debbugs.gnu.org; Mon, 26 Jun 2017 07:12:00 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47807) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dPRvy-0001G4-Lv for submit@debbugs.gnu.org; Mon, 26 Jun 2017 07:11:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPRvx-0002AU-5l for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 07:11:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPRvt-0001EB-6S for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 07:11:56 -0400 Received: from mx.daemon.de ([78.47.130.37]:62258) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dPRvs-0001C7-RQ for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 07:11:53 -0400 Received: from r4.daemon.de (mx.daemon.de [78.47.130.37]) by mx.daemon.de (Postfix) with SMTP id 731C41A6AB2; Mon, 26 Jun 2017 13:11:42 +0200 (CEST) Received: by r4.daemon.de (sSMTP sendmail emulation); Mon, 26 Jun 2017 13:11:42 +0200 Date: Mon, 26 Jun 2017 13:11:42 +0200 From: Tom Message-ID: <20170626111142.GP90138@r4> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="mvpLiMfbWzRoNl4x" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Mailman-Approved-At: Mon, 26 Jun 2017 12:21:57 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --mvpLiMfbWzRoNl4x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline When I set the following in a mode (https://github.com/TLINDEN/config-general-mode): (setq-local hippie-expand-only-buffers '(config-general-mode)) and have a .c file with c-mode open, and a file with config-general mode, then 'try-expand-dabbrev-all-buffers expands from the .c file as well, which is not what I expected. It turns out, that the function (and all other try-expand-* functions as well!) loops over all buffers in a while loop with 'set-buffer, which then uses variables local for that *current* buffer or the global ones, but not buffer-local variables from the original buffer, from where the function was invoked. Since 'hippie-expand-only-buffers is nil globally and not configured locally in c-mode (in my case), it uses dabbrevs found in that file and thus ignores my buffer-local setting. The attached patch fixes this behavior by working on copies of the relevant variables. It fixes 'try-expand-dabbrev-all-buffers only, since I am not sure if the patch would be required by the other try functions as well. best regards, Tom In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of 2015-06-15 on nubic Windowing system distributor `The X.Org Foundation', version 11.0.11501000 System Description: Ubuntu 14.04.4 LTS Configured using: `configure --with-xpm=no --with-jpeg=no --with-gif=no --with-tiff=no' Important settings: value of $LC_MONETARY: de_DE.UTF-8 value of $LC_NUMERIC: de_DE.UTF-8 value of $LC_TIME: de_DE.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: ido-everywhere: t show-paren-mode: t tooltip-mode: t electric-indent-mode: t mouse-wheel-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 column-number-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... [2 times] current-kill: Kill ring is empty Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils help-mode easymenu ido edmacro kmacro cl-loaddefs cl-lib paren time-date 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 system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs ) Memory information: ((conses 16 87889 34583) (symbols 48 18533 1) (miscs 40 52 172) (strings 32 18602 28208) (string-bytes 1 447810) (vectors 16 9991) (vector-slots 8 397326 31713) (floats 8 76 172) (intervals 56 233 101) (buffers 960 12) (heap 1024 29194 3379)) ) --mvpLiMfbWzRoNl4x Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="hippie-exp-el-patch-20170626-tom.patch" *** hippie-exp.el 2017-06-26 12:50:18.923557011 +0200 --- hippie-exp-patched.el 2017-06-26 12:52:12.731563202 +0200 *************** *** 926,932 **** string). It returns t if a new expansion is found, nil otherwise." (let ((expansion ()) (buf (current-buffer)) ! (orig-case-fold-search case-fold-search)) (if (not old) (progn (he-init-string (he-dabbrev-beg) (point)) --- 926,934 ---- string). It returns t if a new expansion is found, nil otherwise." (let ((expansion ()) (buf (current-buffer)) ! (orig-case-fold-search case-fold-search) ! (heib hippie-expand-ignore-buffers) ! (heob hippie-expand-only-buffers)) (if (not old) (progn (he-init-string (he-dabbrev-beg) (point)) *************** *** 941,949 **** (< he-searched-n-bufs hippie-expand-max-buffers))) (set-buffer (car he-search-bufs)) (if (and (not (eq (current-buffer) buf)) ! (if hippie-expand-only-buffers ! (he-buffer-member hippie-expand-only-buffers) ! (not (he-buffer-member hippie-expand-ignore-buffers)))) (save-excursion (save-restriction (if hippie-expand-no-restriction --- 943,951 ---- (< he-searched-n-bufs hippie-expand-max-buffers))) (set-buffer (car he-search-bufs)) (if (and (not (eq (current-buffer) buf)) ! (if heob ! (he-buffer-member heob) ! (not (he-buffer-member heib)))) (save-excursion (save-restriction (if hippie-expand-no-restriction --mvpLiMfbWzRoNl4x-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 29 21:10:45 2017 Received: (at control) by debbugs.gnu.org; 30 Jun 2017 01:10:45 +0000 Received: from localhost ([127.0.0.1]:45215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQkSL-00012Q-L7 for submit@debbugs.gnu.org; Thu, 29 Jun 2017 21:10:45 -0400 Received: from mail-it0-f46.google.com ([209.85.214.46]:37789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQkSJ-00012E-U2 for control@debbugs.gnu.org; Thu, 29 Jun 2017 21:10:44 -0400 Received: by mail-it0-f46.google.com with SMTP id m84so16940521ita.0 for ; Thu, 29 Jun 2017 18:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:mime-version; bh=9zEKnDZhAdc+w8POHRA3t8Wc35dViCJiRCAxNxbXuaE=; b=H838gs8W7eOo9fwQzOLH/iNF/cTg08YYuUAT1mTaNjRUVu3JYDK6MSB6lKYzNqQqRD LNuf7wBKdPM54KS6ccCUTO7ebWY1jVmbWTfiDgOAve06ro8WZV4hzXphqDK/pU9msQR9 rnU9rU+DfRULG6sfXU9KKc7Zhq7nJuttevZneZspa2tAOzLI0XIsdnz+0STVvUQpkTBg dbJ30nJHJzDRD35BZ4t8FHU8DWkB2MjX3xgPw36FreRB+M7r4mnLlC2XK8OILk6uHQVf jXVRM5W7DFoH/7b4sP5E4bX/PhTPq42ESCSHGlU9T5ARc2kFyqplmmI0l+SEriFsWJtD F3vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version; bh=9zEKnDZhAdc+w8POHRA3t8Wc35dViCJiRCAxNxbXuaE=; b=Kb2lS/Xgtnygzps31IkeuHmdiJTWNyaOwElqf6OeO3MqnXV024mDsAVqokcP7V9xga 6xaJNdJDLClWXJy8ATCPaz3WiCChFOP1KY+oU39djyXaNGtmKQgkhVMPPWTeg6GlTx6c CugFVdCQkyFVU+G9dOy/fwGCZyGVFB8ULfmommtEE/9Sfb26Jp0Zhav3ScEhkYtBT2VH peT/zdquJFsqHuCWEObmX1NhN72EBWX7zRLT/ygWZr9CWE6ozYbpTFWzwBgjvQSk/suW 8vk6NExnDcYHWDPsvB0Xt7xtq4d7ntcW5KtS4fqBLJRcdc/ZnyqIV9dDVA2LOwqKGNnK aHyA== X-Gm-Message-State: AKS2vOzqui2OoJ4ynR5c+YsS8R8zQbCbHgBvosUTXJkKmYe+oDfj/egy SzM6d4hoToHyoGS5 X-Received: by 10.36.244.3 with SMTP id d3mr5248655iti.62.1498785038122; Thu, 29 Jun 2017 18:10:38 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id b18sm1411740itd.25.2017.06.29.18.10.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Jun 2017 18:10:37 -0700 (PDT) From: npostavs@users.sourceforge.net To: control@debbugs.gnu.org Subject: control message for bug #27501 Date: Thu, 29 Jun 2017 21:12:14 -0400 Message-ID: <8737aimg7l.fsf@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) forcemerge 27501 16607 quit From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 02 15:34:22 2017 Received: (at control) by debbugs.gnu.org; 2 Jul 2017 19:34:22 +0000 Received: from localhost ([127.0.0.1]:49030 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRkdO-0002uv-F8 for submit@debbugs.gnu.org; Sun, 02 Jul 2017 15:34:22 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:35353) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRkdJ-0002ud-Jb; Sun, 02 Jul 2017 15:34:17 -0400 Received: by mail-io0-f194.google.com with SMTP id 84so7216346iop.2; Sun, 02 Jul 2017 12:34:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Hwn1e+I9sGXBIV5nUsUOG07Bzlv4jauD2RTuy5gjj7o=; b=uHjpd74qDXp5htAT7P7AQiz6wyxoIxS9xsaZyXY56OiJArx5MOeVjWYGOc15kp4v+o 7xjqybeDygurkNw8ues5S53TtNw7LIP5hr0ZTL+ggjt8is/yFLV83xG6INygXhmHH3/B BmVrTsMCztykafBEyXy/GK8MDgrbYT/mmuPJLvSHcswyuy3siC0OUyTNMu8Hzy5UsZxq rrdw5nesz0Cuf58dzC0PoAkqlq2EMtN//GaCmDjFyO6VL1XacYSXCP6ll0ykJ64Up0L6 rBrjgeOtRZECgdVKIlCVOYIPDtb3HELUYT26H/D7eFBBI+QQtrsDMQsfJRJy6s3f08Kz /O+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Hwn1e+I9sGXBIV5nUsUOG07Bzlv4jauD2RTuy5gjj7o=; b=mAhRl9/ZO011o77xiqDPBU/8YYrV44nkpEQ4GPVQiecolwHX3B2L2oe9LFFrz2XvZX X+27hany4P4ObXu9q+lPy/9JsK7KwPCb0zkPtU6+YRu4vMdit2WcEPf29+xdYGJIimlc guONTDnevv2atOSUAcFH8X/yhBX1yJWD0/MesdtjJsA2yS3o+cK128wjtBs60yq5+hbE +7nMT6u3NEBpDZ3JGVor5kBolvES/KbuO6llfAyrnVKAuPNtuAbm6yDnkYx4c4MNAAdD 0CvjqaCY0yvNK0NLuHYtgEm5jsv+6pxUOIB8A5ZR5TBx1DrW++GuYpRmgSx91DuSljvK Y/VQ== X-Gm-Message-State: AKS2vOy2ZAspwINb1i+KQrqKswJ2rPEyhL2Rx9j7RkFVYLoYbzqR3hhv MQJfwR1wmHUbuLVa X-Received: by 10.107.173.220 with SMTP id m89mr35783568ioo.152.1499024047979; Sun, 02 Jul 2017 12:34:07 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id z62sm6918896ioz.37.2017.07.02.12.34.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 02 Jul 2017 12:34:07 -0700 (PDT) From: npostavs@users.sourceforge.net To: Lars Ingebrigtsen Subject: Re: bug#16607: hippie-expand, a patch References: <87ziuqlrfl.fsf@gnus.org> Date: Sun, 02 Jul 2017 15:35:43 -0400 In-Reply-To: <87ziuqlrfl.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 24 Feb 2016 14:26:22 +1100") Message-ID: <87shiek4xc.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: control Cc: 16607@debbugs.gnu.org, "Emilio C. Lopes" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) tags 16607 fixed close 16607 25.1 quit Lars Ingebrigtsen writes: > Emilio C. Lopes writes: > >> `hippie-expand' use several methods to expand text in the current buffer. >> Some of those methods search for possible expansions in multiple Emacs >> buffers, controlled by the variables `hippie-expand-ignore-buffers' and >> `hippie-expand-only-buffers'. >> >> It would be useful to be able to set these two variables locally in a >> Buffer (using `make-local-variable'). This would allow for example to >> set up `hippie-expand' in Lisp buffers to only search for possible >> expansions in other Lisp buffers. >> >> As it is now (Emacs 24.3) the functions in `hippie-expand' using those >> variables do so in the context of the buffers where potential completions >> are searched for. The patch bellow causes the lookup to occur in the >> buffer where `hippie-expand' was invoked. > > I think the patch below looks reasonable, but I've never used > hippie-expand. Are there anybody that can weigh in on this? This was already added in Emacs 25.1. [1: 8576251878]: 2014-06-12 09:45:52 -0400 * lisp/hippie-exp.el (try-expand-line-all-buffers) (try-expand-list-all-buffers, try-expand-dabbrev-all-buffers): Read hippie-expand-only-buffers and hippie-expand-ignore-buffers in the original buffer, in case they're buffer-local. http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=8576251878f59f686b3a14c574a402549eabcbc1