Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
20c65d08
Commit
20c65d08
authored
Mar 11, 2006
by
Bill Wohler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(image-load-path-for-library): Merged changes from Reiner. Add
no-error argument. If path t, just return directory.
parent
08f99a54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
lisp/image.el
lisp/image.el
+17
-5
No files found.
lisp/image.el
View file @
20c65d08
...
@@ -77,7 +77,7 @@ value is used as a list of directories to search.")
...
@@ -77,7 +77,7 @@ value is used as a list of directories to search.")
(
list
(
file-name-as-directory
(
expand-file-name
"images"
data-directory
))
(
list
(
file-name-as-directory
(
expand-file-name
"images"
data-directory
))
'data-directory
'load-path
)))
'data-directory
'load-path
)))
(
defun
image-load-path-for-library
(
library
image
&optional
path
)
(
defun
image-load-path-for-library
(
library
image
&optional
path
no-error
)
"Return a suitable search path for images relative to LIBRARY.
"Return a suitable search path for images relative to LIBRARY.
Images for LIBRARY are searched for in \"../../etc/images\" and
Images for LIBRARY are searched for in \"../../etc/images\" and
...
@@ -85,8 +85,12 @@ Images for LIBRARY are searched for in \"../../etc/images\" and
...
@@ -85,8 +85,12 @@ Images for LIBRARY are searched for in \"../../etc/images\" and
well as in `image-load-path' and `load-path'.
well as in `image-load-path' and `load-path'.
This function returns the value of `load-path' augmented with the
This function returns the value of `load-path' augmented with the
path to IMAGE. If PATH is given, it is used instead of
directory containing IMAGE. If PATH is given, it is used instead
`load-path'.
of `load-path'. If PATH is t, just return the directory that
contains IMAGE.
If NO-ERROR is non-nil, return nil if a suitable path can't be
found rather than signaling an error.
Here is an example that uses a common idiom to provide
Here is an example that uses a common idiom to provide
compatibility with versions of Emacs that lack the variable
compatibility with versions of Emacs that lack the variable
...
@@ -137,11 +141,19 @@ compatibility with versions of Emacs that lack the variable
...
@@ -137,11 +141,19 @@ compatibility with versions of Emacs that lack the variable
(
setq
img
(
directory-file-name
parent
)
(
setq
img
(
directory-file-name
parent
)
dir
(
expand-file-name
"../"
dir
)))
dir
(
expand-file-name
"../"
dir
)))
(
setq
image-directory
dir
)))))
(
setq
image-directory
dir
)))))
(
no-error
;; In this case we will return nil.
(
message
"Could not find image %s for library %s"
image
library
))
(
t
(
t
(
error
"Could not find image %s for library %s"
image
library
)))
(
error
"Could not find image %s for library %s"
image
library
)))
;; Return augmented `image-load-path' or `load-path'.
;; Return the directory, nil if no-error was non-nil and a
(
cond
((
and
path
(
symbolp
path
))
;; suitable path could not be found, or an augmented
;; `image-load-path' or `load-path'.
(
cond
((
or
(
null
image-directory
)
(
eq
path
t
))
image-directory
)
((
and
path
(
symbolp
path
))
(
nconc
(
list
image-directory
)
(
nconc
(
list
image-directory
)
(
delete
image-directory
(
delete
image-directory
(
if
(
boundp
path
)
(
if
(
boundp
path
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment