[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Adding an `or condition without changing code
From: |
Tim Johnson |
Subject: |
Adding an `or condition without changing code |
Date: |
Sun, 12 Jan 2020 14:29:34 -0900 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
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
- Adding an `or condition without changing code,
Tim Johnson <=