unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Adding an `or condition without changing code
@ 2020-01-12 23:29 Tim Johnson
  2020-01-13 14:37 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Johnson @ 2020-01-12 23:29 UTC (permalink / raw)
  To: MLEmacs

Using emacs 26.1 on ubuntu

I'm implementing dired-single-buffer

The function of the same name has the following `let initialization

(let ((name (or default-dirname (dired-get-filename nil t)))) ;; 
default-dirname is an optional argument to dired-single-buffer

The two conditions to `or are not sufficient if I call 
dired-single-buffer from an unvisited buffer. The result is that `name 
is nil and a string-p, nil error is thrown.

A simple hack is to add a third condition to `or

(let ((name (or default-dirname (dired-get-filename nil t) "~/")))  ;; 
fall-back to /home/user

But, it IS a hack and means I have altered some good citizen's code.

How can that be resolved? Might the solution be a customization of dired?

 From the documentation of dired-get-filename I don't grok a solution....

thanks

-- 

Tim
tj49.com




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

end of thread, other threads:[~2020-01-13 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-12 23:29 Adding an `or condition without changing code Tim Johnson
2020-01-13 14:37 ` Stefan Monnier
2020-01-13 18:55   ` Tim Johnson

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