Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
c0696e1b
Commit
c0696e1b
authored
Mar 16, 2006
by
Bill Wohler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(image-load-path-for-library): Prefer user's images in
image-load-path.
parent
39f89139
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
27 deletions
+48
-27
lisp/ChangeLog
lisp/ChangeLog
+5
-0
lisp/image.el
lisp/image.el
+43
-27
No files found.
lisp/ChangeLog
View file @
c0696e1b
2006-03-16 Bill Wohler <wohler@newt.com>
* image.el (image-load-path-for-library): Prefer user's images in
image-load-path.
2006-03-16 Martin Rudalics <rudalics@gmx.at>
* mouse.el (mouse-drag-vertical-line): Use window-inside-edges
...
...
lisp/image.el
View file @
c0696e1b
...
...
@@ -81,10 +81,11 @@ value is used as a list of directories to search.")
(
defun
image-load-path-for-library
(
library
image
&optional
path
no-error
)
"Return a suitable search path for images relative to LIBRARY.
First it searches for IMAGE in a path suitable for LIBRARY, which
includes \"../../etc/images\" and \"../etc/images\" relative to
the library file itself, followed by `image-load-path' and
`load-path'.
First it searches for IMAGE in `image-load-path' (excluding
\"`data-directory'/images\") and `load-path', followed by a path
suitable for LIBRARY, which includes \"../../etc/images\" and
\"../etc/images\" relative to the library file itself, and then
in \"`data-directory'/images\".
Then this function returns a list of directories which contains
first the directory in which IMAGE was found, followed by the
...
...
@@ -109,8 +110,36 @@ compatibility with versions of Emacs that lack the variable
(mh-tool-bar-folder-buttons-init))"
(
unless
library
(
error
"No library specified"
))
(
unless
image
(
error
"No image specified"
))
(
let
((
image-directory
))
(
let
(
image-directory
image-directory-load-path
)
;; Check for images in image-load-path or load-path.
(
let
((
img
image
)
(
dir
(
or
;; Images in image-load-path.
(
image-search-load-path
image
)
;; Images in load-path.
(
locate-library
image
)))
parent
)
;; Since the image might be in a nested directory (for
;; example, mail/attach.pbm), adjust `image-directory'
;; accordingly.
(
when
dir
(
setq
dir
(
file-name-directory
dir
))
(
while
(
setq
parent
(
file-name-directory
img
))
(
setq
img
(
directory-file-name
parent
)
dir
(
expand-file-name
"../"
dir
))))
(
setq
image-directory-load-path
dir
))
;; If `image-directory-load-path' isn't Emacs' image directory,
;; it's probably a user preference, so use it. Then use a
;; relative setting if possible; otherwise, use
;; `image-directory-load-path'.
(
cond
;; User-modified image-load-path?
((
and
image-directory-load-path
(
not
(
equal
image-directory-load-path
(
file-name-as-directory
(
expand-file-name
"images"
data-directory
)))))
(
setq
image-directory
image-directory-load-path
))
;; Try relative setting.
((
let
(
library-name
d1ei
d2ei
)
;; First, find library in the load-path.
...
...
@@ -120,33 +149,20 @@ compatibility with versions of Emacs that lack the variable
;; And then set image-directory relative to that.
(
setq
;; Go down 2 levels.
d2ei
(
expand-file-name
(
concat
(
file-name-directory
library-name
)
"../../etc/images"
))
d2ei
(
file-name-as-directory
(
expand-file-name
(
concat
(
file-name-directory
library-name
)
"../../etc/images"
)))
;; Go down 1 level.
d1ei
(
expand-file-name
(
concat
(
file-name-directory
library-name
)
"../etc/images"
)))
d1ei
(
file-name-as-directory
(
expand-file-name
(
concat
(
file-name-directory
library-name
)
"../etc/images"
))))
(
setq
image-directory
;; Set it to nil if image is not found.
(
cond
((
file-exists-p
(
expand-file-name
image
d2ei
))
d2ei
)
((
file-exists-p
(
expand-file-name
image
d1ei
))
d1ei
)))))
;; Check for images in image-load-path or load-path.
((
let
((
img
image
)
(
dir
(
or
;; Images in image-load-path.
(
image-search-load-path
image
)
;; Images in load-path.
(
locate-library
image
)))
parent
)
;; Since the image might be in a nested directory (for
;; example, mail/attach.pbm), adjust `image-directory'
;; accordingly.
(
and
dir
(
setq
dir
(
file-name-directory
dir
))
(
progn
(
while
(
setq
parent
(
file-name-directory
img
))
(
setq
img
(
directory-file-name
parent
)
dir
(
expand-file-name
"../"
dir
)))
(
setq
image-directory
dir
)))))
;; Use Emacs' image directory.
(
image-directory-load-path
(
setq
image-directory
image-directory-load-path
))
(
no-error
(
message
"Could not find image %s for library %s"
image
library
))
(
t
...
...
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