unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* C-x C-w trouble
@ 2005-07-09  2:45 Luc Teirlinck
  2005-07-10  5:19 ` Richard M. Stallman
  0 siblings, 1 reply; 2+ messages in thread
From: Luc Teirlinck @ 2005-07-09  2:45 UTC (permalink / raw)


The following change:

  * files.el (set-visited-file-name): Report the error
    for "empty filename" earlier.

has problems.

Do `emacs -q -nbc'
C-x C-w
Call your new file "test", or whatever.
Result:
set-visited-file-name: Wrong type argument: stringp, nil

The small patch below fixes the problem, but since I do not know the
reason for the recent change, I am not sure that it is correct.  I can
install if it looks OK.

The problem is that buffer-file-name is nil for the *scratch* buffer
and (file-name-nondirectory nil) yields the above error.

===File ~/files.el-diff=====================================
*** files.el	08 Jul 2005 17:47:33 -0500	1.778
--- files.el	08 Jul 2005 21:03:17 -0500	
***************
*** 2545,2551 ****
  	  (if find-file-visit-truename
  	      (setq filename truename))))
      (if filename
! 	(let ((new-name (file-name-nondirectory buffer-file-name)))
  	  (if (string= new-name "")
  	      (error "Empty file name"))))
      (let ((buffer (and filename (find-buffer-visiting filename))))
--- 2545,2551 ----
  	  (if find-file-visit-truename
  	      (setq filename truename))))
      (if filename
! 	(let ((new-name (file-name-nondirectory filename)))
  	  (if (string= new-name "")
  	      (error "Empty file name"))))
      (let ((buffer (and filename (find-buffer-visiting filename))))
============================================================

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

* Re: C-x C-w trouble
  2005-07-09  2:45 C-x C-w trouble Luc Teirlinck
@ 2005-07-10  5:19 ` Richard M. Stallman
  0 siblings, 0 replies; 2+ messages in thread
From: Richard M. Stallman @ 2005-07-10  5:19 UTC (permalink / raw)
  Cc: emacs-devel

Your fix looks correct.  Please install it.

Thanks.

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

end of thread, other threads:[~2005-07-10  5:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-09  2:45 C-x C-w trouble Luc Teirlinck
2005-07-10  5:19 ` Richard M. Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).