From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#32195: 26.1; [PATCH] Support indirect buffers in `diff-buffer-with-file' Date: Wed, 18 Jul 2018 19:50:26 +1200 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2E881EF4CCE1DD004A3957F4" X-Trace: blaine.gmane.org 1531900151 3700 195.159.176.226 (18 Jul 2018 07:49:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 18 Jul 2018 07:49:11 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 To: 32195@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 18 09:49:07 2018 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 1ffhCs-0000qx-Sr for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jul 2018 09:49:07 +0200 Original-Received: from localhost ([::1]:35219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffhEy-00049A-6L for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jul 2018 03:51:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffhEn-00047g-Hy for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 03:51:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ffhEk-0007ub-F8 for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 03:51:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41109) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ffhEk-0007uX-9m for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 03:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ffhEk-00037b-2M for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 03:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Jul 2018 07:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32195 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.153190024811976 (code B ref -1); Wed, 18 Jul 2018 07:51:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Jul 2018 07:50:48 +0000 Original-Received: from localhost ([127.0.0.1]:46127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ffhEW-000374-0o for submit@debbugs.gnu.org; Wed, 18 Jul 2018 03:50:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37897) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ffhET-00036o-DG for submit@debbugs.gnu.org; Wed, 18 Jul 2018 03:50:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ffhEM-0007I2-Oa for submit@debbugs.gnu.org; Wed, 18 Jul 2018 03:50:40 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57938) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ffhEM-0007GP-Jl for submit@debbugs.gnu.org; Wed, 18 Jul 2018 03:50:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffhEL-0003oL-0T for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 03:50:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ffhEH-00078P-PL for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 03:50:37 -0400 Original-Received: from smtp-1.orcon.net.nz ([60.234.4.34]:50958) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ffhEH-0006yT-3i for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 03:50:33 -0400 Original-Received: from [150.107.172.125] (port=20748 helo=[192.168.20.103]) by smtp-1.orcon.net.nz with esmtpa (Exim 4.86_2) (envelope-from ) id 1ffhEB-0007vy-8A for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 19:50:27 +1200 Content-Language: en-GB X-GeoIP: NZ X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:148631 Archived-At: This is a multi-part message in MIME format. --------------2E881EF4CCE1DD004A3957F4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit In an indirect buffer `buffer-file-name' is nil, and consequently M-x diff-buffer-with-file fails with "diff-no-select: Wrong type argument: stringp, nil" I think it would be sensible to use the base buffer's file name in this situation. Patch attached. -Phil In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2018-06-19 built on shodan Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 System Description: Ubuntu 18.04 LTS Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Scanning for dabbrevs...done user-error: No dynamic expansion for ‘diff-bu’ found Configured using: 'configure --prefix=/home/phil/emacs/26.1/usr/local --with-x-toolkit=lucid --without-sound' Configured features: XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK DBUS GSETTINGS NOTIFY GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 THREADS LCMS2 Important settings: value of $LANG: en_NZ.UTF-8 locale-coding-system: utf-8 Major mode: Dired by name Minor modes in effect: show-paren-mode: t minibuffer-depth-indicate-mode: t winner-mode: t global-hl-line-mode: t tooltip-mode: t global-eldoc-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 auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr dabbrev emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils dired-x easymenu paren mb-depth winner ring hl-line dired dired-loaddefs advice elec-pair time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors 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 composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 101859 10773) (symbols 48 20824 1) (miscs 40 108 168) (strings 32 30401 971) (string-bytes 1 796958) (vectors 16 15482) (vector-slots 8 504854 6666) (floats 8 60 57) (intervals 56 279 0) (buffers 992 13)) --------------2E881EF4CCE1DD004A3957F4 Content-Type: text/x-patch; name="0001-lisp-vc-diff.el-diff-buffer-with-file-Support-indire.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-lisp-vc-diff.el-diff-buffer-with-file-Support-indire.pa"; filename*1="tch" >From d3a57c63deba7aafad821418902c47dfb4fc0ccf Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Wed, 18 Jul 2018 19:32:11 +1200 Subject: [PATCH] * lisp/vc/diff.el (diff-buffer-with-file): Support indirect buffers --- lisp/vc/diff.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index b850350..ac94586 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -226,8 +226,9 @@ diff-buffer-with-file "View the differences between BUFFER and its associated file. This requires the external program `diff' to be in your `exec-path'." (interactive "bBuffer: ") - (with-current-buffer (get-buffer (or buffer (current-buffer))) - (diff buffer-file-name (current-buffer) nil 'noasync))) + (let ((buf (get-buffer (or buffer (current-buffer))))) + (with-current-buffer (or (buffer-base-buffer buf) buf) + (diff buffer-file-name (current-buffer) nil 'noasync)))) (provide 'diff) -- 2.8.3 --------------2E881EF4CCE1DD004A3957F4--