From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tom Newsgroups: gmane.emacs.bugs Subject: bug#27501: 24.5; hippie-expand-only-buffers not considered when buffer-local in 'try-expand-dabbrev-all-buffers Date: Mon, 26 Jun 2017 13:11:42 +0200 Message-ID: <20170626111142.GP90138@r4> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="mvpLiMfbWzRoNl4x" X-Trace: blaine.gmane.org 1498494136 3528 195.159.176.226 (26 Jun 2017 16:22:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Jun 2017 16:22:16 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: 27501@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 26 18:22:11 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPWm8-0000VY-IG for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Jun 2017 18:22:08 +0200 Original-Received: from localhost ([::1]:47535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPWmD-0008Bw-AA for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Jun 2017 12:22:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPWm5-0008Bj-NZ for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 12:22:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPWm2-000895-7m for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 12:22:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPWm2-000890-33 for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 12:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dPWm1-0002CQ-NM for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 12:22:01 -0400 X-Loop: help-debbugs@gnu.org 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: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14984941188443 (code B ref -1); Mon, 26 Jun 2017 16:22:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Jun 2017 16:21:58 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-Received: by r4.daemon.de (sSMTP sendmail emulation); Mon, 26 Jun 2017 13:11:42 +0200 Content-Disposition: inline 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-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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133932 Archived-At: --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--