all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#32195: 26.1; [PATCH] Support indirect buffers in `diff-buffer-with-file'
@ 2018-07-18  7:50 Phil Sainty
  2018-07-27  7:04 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Sainty @ 2018-07-18  7:50 UTC (permalink / raw)
  To: 32195

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

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))

[-- Attachment #2: 0001-lisp-vc-diff.el-diff-buffer-with-file-Support-indire.patch --]
[-- Type: text/x-patch, Size: 987 bytes --]

From d3a57c63deba7aafad821418902c47dfb4fc0ccf Mon Sep 17 00:00:00 2001
From: Phil Sainty <psainty@orcon.net.nz>
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


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

* bug#32195: 26.1; [PATCH] Support indirect buffers in `diff-buffer-with-file'
  2018-07-18  7:50 bug#32195: 26.1; [PATCH] Support indirect buffers in `diff-buffer-with-file' Phil Sainty
@ 2018-07-27  7:04 ` Eli Zaretskii
  2018-07-28 12:38   ` Phil Sainty
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2018-07-27  7:04 UTC (permalink / raw)
  To: Phil Sainty; +Cc: 32195

> From: Phil Sainty <psainty@orcon.net.nz>
> Date: Wed, 18 Jul 2018 19:50:26 +1200
> 
> 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.

Looks reasonable.  Can you push (to the master branch), or do you need
someone to do that for you?  If the latter, please provide a commit
log message.

Thanks.





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

* bug#32195: 26.1; [PATCH] Support indirect buffers in `diff-buffer-with-file'
  2018-07-27  7:04 ` Eli Zaretskii
@ 2018-07-28 12:38   ` Phil Sainty
  0 siblings, 0 replies; 3+ messages in thread
From: Phil Sainty @ 2018-07-28 12:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32195-done

Pushed to master in commit 1bcf5d02da96784a04034b4c0aba8fdfa1413c4e

-Phil






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

end of thread, other threads:[~2018-07-28 12:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-18  7:50 bug#32195: 26.1; [PATCH] Support indirect buffers in `diff-buffer-with-file' Phil Sainty
2018-07-27  7:04 ` Eli Zaretskii
2018-07-28 12:38   ` Phil Sainty

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.