diff options
| author | Lars Ingebrigtsen | 2016-02-14 16:35:24 +1100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-02-14 16:35:24 +1100 |
| commit | 9de3de8cbf0e63de7e11d6f2051fc3ad891c613c (patch) | |
| tree | 38078f24f797a9a75457933abf5ee2c4a00bb211 | |
| parent | e1f22c1739f2269d1efbb25d4d74c8afea9f47db (diff) | |
| download | emacs-9de3de8cbf0e63de7e11d6f2051fc3ad891c613c.tar.gz emacs-9de3de8cbf0e63de7e11d6f2051fc3ad891c613c.zip | |
Remove some compat functions from gmm-utils.el
* lisp/gnus/gmm-utils.el (gmm-tool-bar-from-list): Remove
compat code.
(gmm-image-search-load-path): Remove.
(gmm-image-load-path-for-library): Remove.
| -rw-r--r-- | lisp/gnus/gmm-utils.el | 121 | ||||
| -rw-r--r-- | lisp/gnus/gnus-group.el | 5 | ||||
| -rw-r--r-- | lisp/gnus/gnus-sum.el | 4 | ||||
| -rw-r--r-- | lisp/gnus/message.el | 5 |
4 files changed, 13 insertions, 122 deletions
diff --git a/lisp/gnus/gmm-utils.el b/lisp/gnus/gmm-utils.el index 34db4bd1000..785a286c915 100644 --- a/lisp/gnus/gmm-utils.el +++ b/lisp/gnus/gmm-utils.el | |||
| @@ -198,15 +198,13 @@ item. When \\[describe-key] <icon> shows \"<tool-bar> <new-file> | |||
| 198 | runs the command find-file\", then use `new-file' in ZAP-LIST. | 198 | runs the command find-file\", then use `new-file' in ZAP-LIST. |
| 199 | 199 | ||
| 200 | DEFAULT-MAP specifies the default key map for ICON-LIST." | 200 | DEFAULT-MAP specifies the default key map for ICON-LIST." |
| 201 | (let (;; For Emacs 21, we must let-bind `tool-bar-map'. In Emacs 22, we | 201 | (let ((map (if (eq zap-list t) |
| 202 | ;; could use some other local variable. | 202 | (make-sparse-keymap) |
| 203 | (tool-bar-map (if (eq zap-list t) | 203 | (copy-keymap tool-bar-map)))) |
| 204 | (make-sparse-keymap) | ||
| 205 | (copy-keymap tool-bar-map)))) | ||
| 206 | (when (listp zap-list) | 204 | (when (listp zap-list) |
| 207 | ;; Zap some items which aren't relevant for this mode and take up space. | 205 | ;; Zap some items which aren't relevant for this mode and take up space. |
| 208 | (dolist (key zap-list) | 206 | (dolist (key zap-list) |
| 209 | (define-key tool-bar-map (vector key) nil))) | 207 | (define-key map (vector key) nil))) |
| 210 | (mapc (lambda (el) | 208 | (mapc (lambda (el) |
| 211 | (let ((command (car el)) | 209 | (let ((command (car el)) |
| 212 | (icon (nth 1 el)) | 210 | (icon (nth 1 el)) |
| @@ -218,7 +216,7 @@ DEFAULT-MAP specifies the default key map for ICON-LIST." | |||
| 218 | ;; widget. Suppress tooltip by adding `:enable nil'. | 216 | ;; widget. Suppress tooltip by adding `:enable nil'. |
| 219 | (if (fboundp 'tool-bar-local-item) | 217 | (if (fboundp 'tool-bar-local-item) |
| 220 | (apply 'tool-bar-local-item icon nil nil | 218 | (apply 'tool-bar-local-item icon nil nil |
| 221 | tool-bar-map :enable nil props) | 219 | map :enable nil props) |
| 222 | ;; (tool-bar-local-item ICON DEF KEY MAP &rest PROPS) | 220 | ;; (tool-bar-local-item ICON DEF KEY MAP &rest PROPS) |
| 223 | ;; (tool-bar-add-item ICON DEF KEY &rest PROPS) | 221 | ;; (tool-bar-add-item ICON DEF KEY &rest PROPS) |
| 224 | (apply 'tool-bar-add-item icon nil nil :enable nil props))) | 222 | (apply 'tool-bar-add-item icon nil nil :enable nil props))) |
| @@ -226,18 +224,18 @@ DEFAULT-MAP specifies the default key map for ICON-LIST." | |||
| 226 | (apply 'tool-bar-local-item | 224 | (apply 'tool-bar-local-item |
| 227 | icon command | 225 | icon command |
| 228 | (intern icon) ;; reuse icon or fmap here? | 226 | (intern icon) ;; reuse icon or fmap here? |
| 229 | tool-bar-map props)) | 227 | map props)) |
| 230 | (t ;; A menu command | 228 | (t ;; A menu command |
| 231 | (apply 'tool-bar-local-item-from-menu | 229 | (apply 'tool-bar-local-item-from-menu |
| 232 | ;; (apply 'tool-bar-local-item icon def key | 230 | ;; (apply 'tool-bar-local-item icon def key |
| 233 | ;; tool-bar-map props) | 231 | ;; tool-bar-map props) |
| 234 | command icon tool-bar-map (symbol-value fmap) | 232 | command icon map (symbol-value fmap) |
| 235 | props))) | 233 | props))) |
| 236 | t)) | 234 | t)) |
| 237 | (if (symbolp icon-list) | 235 | (if (symbolp icon-list) |
| 238 | (eval icon-list) | 236 | (eval icon-list) |
| 239 | icon-list)) | 237 | icon-list)) |
| 240 | tool-bar-map)) | 238 | map)) |
| 241 | 239 | ||
| 242 | (defmacro defun-gmm (name function arg-list &rest body) | 240 | (defmacro defun-gmm (name function arg-list &rest body) |
| 243 | "Create function NAME. | 241 | "Create function NAME. |
| @@ -248,109 +246,6 @@ Otherwise, create function NAME with ARG-LIST and BODY." | |||
| 248 | `(defalias ',name ',function) | 246 | `(defalias ',name ',function) |
| 249 | `(defun ,name ,arg-list ,@body)))) | 247 | `(defun ,name ,arg-list ,@body)))) |
| 250 | 248 | ||
| 251 | (defun-gmm gmm-image-search-load-path | ||
| 252 | image-search-load-path (file &optional path) | ||
| 253 | "Emacs 21 and XEmacs don't have `image-search-load-path'. | ||
| 254 | This function returns nil on those systems." | ||
| 255 | nil) | ||
| 256 | |||
| 257 | ;; Cf. `mh-image-load-path-for-library' in `mh-compat.el'. | ||
| 258 | |||
| 259 | (defun-gmm gmm-image-load-path-for-library | ||
| 260 | image-load-path-for-library (library image &optional path no-error) | ||
| 261 | "Return a suitable search path for images used by LIBRARY. | ||
| 262 | |||
| 263 | It searches for IMAGE in `image-load-path' (excluding | ||
| 264 | \"`data-directory'/images\") and `load-path', followed by a path | ||
| 265 | suitable for LIBRARY, which includes \"../../etc/images\" and | ||
| 266 | \"../etc/images\" relative to the library file itself, and then | ||
| 267 | in \"`data-directory'/images\". | ||
| 268 | |||
| 269 | Then this function returns a list of directories which contains | ||
| 270 | first the directory in which IMAGE was found, followed by the | ||
| 271 | value of `load-path'. If PATH is given, it is used instead of | ||
| 272 | `load-path'. | ||
| 273 | |||
| 274 | If NO-ERROR is non-nil and a suitable path can't be found, don't | ||
| 275 | signal an error. Instead, return a list of directories as before, | ||
| 276 | except that nil appears in place of the image directory. | ||
| 277 | |||
| 278 | Here is an example that uses a common idiom to provide | ||
| 279 | compatibility with versions of Emacs that lack the variable | ||
| 280 | `image-load-path': | ||
| 281 | |||
| 282 | ;; Shush compiler. | ||
| 283 | (defvar image-load-path) | ||
| 284 | |||
| 285 | (let* ((load-path (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\")) | ||
| 286 | (image-load-path (cons (car load-path) | ||
| 287 | (when (boundp \\='image-load-path) | ||
| 288 | image-load-path)))) | ||
| 289 | (mh-tool-bar-folder-buttons-init))" | ||
| 290 | (unless library (error "No library specified")) | ||
| 291 | (unless image (error "No image specified")) | ||
| 292 | (let (image-directory image-directory-load-path) | ||
| 293 | ;; Check for images in image-load-path or load-path. | ||
| 294 | (let ((img image) | ||
| 295 | (dir (or | ||
| 296 | ;; Images in image-load-path. | ||
| 297 | (image-search-load-path image) | ||
| 298 | ;; Images in load-path. | ||
| 299 | (locate-library image))) | ||
| 300 | parent) | ||
| 301 | ;; Since the image might be in a nested directory (for | ||
| 302 | ;; example, mail/attach.pbm), adjust `image-directory' | ||
| 303 | ;; accordingly. | ||
| 304 | (when dir | ||
| 305 | (setq dir (file-name-directory dir)) | ||
| 306 | (while (setq parent (file-name-directory img)) | ||
| 307 | (setq img (directory-file-name parent) | ||
| 308 | dir (expand-file-name "../" dir)))) | ||
| 309 | (setq image-directory-load-path dir)) | ||
| 310 | |||
| 311 | ;; If `image-directory-load-path' isn't Emacs's image directory, | ||
| 312 | ;; it's probably a user preference, so use it. Then use a | ||
| 313 | ;; relative setting if possible; otherwise, use | ||
| 314 | ;; `image-directory-load-path'. | ||
| 315 | (cond | ||
| 316 | ;; User-modified image-load-path? | ||
| 317 | ((and image-directory-load-path | ||
| 318 | (not (equal image-directory-load-path | ||
| 319 | (file-name-as-directory | ||
| 320 | (expand-file-name "images" data-directory))))) | ||
| 321 | (setq image-directory image-directory-load-path)) | ||
| 322 | ;; Try relative setting. | ||
| 323 | ((let (library-name d1ei d2ei) | ||
| 324 | ;; First, find library in the load-path. | ||
| 325 | (setq library-name (locate-library library)) | ||
| 326 | (if (not library-name) | ||
| 327 | (error "Cannot find library %s in load-path" library)) | ||
| 328 | ;; And then set image-directory relative to that. | ||
| 329 | (setq | ||
| 330 | ;; Go down 2 levels. | ||
| 331 | d2ei (file-name-as-directory | ||
| 332 | (expand-file-name | ||
| 333 | (concat (file-name-directory library-name) "../../etc/images"))) | ||
| 334 | ;; Go down 1 level. | ||
| 335 | d1ei (file-name-as-directory | ||
| 336 | (expand-file-name | ||
| 337 | (concat (file-name-directory library-name) "../etc/images")))) | ||
| 338 | (setq image-directory | ||
| 339 | ;; Set it to nil if image is not found. | ||
| 340 | (cond ((file-exists-p (expand-file-name image d2ei)) d2ei) | ||
| 341 | ((file-exists-p (expand-file-name image d1ei)) d1ei))))) | ||
| 342 | ;; Use Emacs's image directory. | ||
| 343 | (image-directory-load-path | ||
| 344 | (setq image-directory image-directory-load-path)) | ||
| 345 | (no-error | ||
| 346 | (message "Could not find image %s for library %s" image library)) | ||
| 347 | (t | ||
| 348 | (error "Could not find image %s for library %s" image library))) | ||
| 349 | |||
| 350 | ;; Return an augmented `path' or `load-path'. | ||
| 351 | (nconc (list image-directory) | ||
| 352 | (delete image-directory (copy-sequence (or path load-path)))))) | ||
| 353 | |||
| 354 | (defun gmm-customize-mode (&optional mode) | 249 | (defun gmm-customize-mode (&optional mode) |
| 355 | "Customize customization group for MODE. | 250 | "Customize customization group for MODE. |
| 356 | If mode is nil, use `major-mode' of the current buffer." | 251 | If mode is nil, use `major-mode' of the current buffer." |
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 34ec11076ba..f42f7989533 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el | |||
| @@ -1084,9 +1084,8 @@ When FORCE, rebuild the tool bar." | |||
| 1084 | (display-graphic-p) | 1084 | (display-graphic-p) |
| 1085 | (or (not gnus-group-tool-bar-map) force)) | 1085 | (or (not gnus-group-tool-bar-map) force)) |
| 1086 | (let* ((load-path | 1086 | (let* ((load-path |
| 1087 | (gmm-image-load-path-for-library "gnus" | 1087 | (image-load-path-for-library |
| 1088 | "gnus/toggle-subscription.xpm" | 1088 | "gnus" "gnus/toggle-subscription.xpm" nil t)) |
| 1089 | nil t)) | ||
| 1090 | (image-load-path (cons (car load-path) image-load-path)) | 1089 | (image-load-path (cons (car load-path) image-load-path)) |
| 1091 | (map (gmm-tool-bar-from-list gnus-group-tool-bar | 1090 | (map (gmm-tool-bar-from-list gnus-group-tool-bar |
| 1092 | gnus-group-tool-bar-zap-list | 1091 | gnus-group-tool-bar-zap-list |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index d3e5ece63ae..e651c050feb 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -2938,9 +2938,7 @@ When FORCE, rebuild the tool bar." | |||
| 2938 | tool-bar-mode | 2938 | tool-bar-mode |
| 2939 | (or (not gnus-summary-tool-bar-map) force)) | 2939 | (or (not gnus-summary-tool-bar-map) force)) |
| 2940 | (let* ((load-path | 2940 | (let* ((load-path |
| 2941 | (gmm-image-load-path-for-library "gnus" | 2941 | (image-load-path-for-library "gnus" "mail/save.xpm" nil t)) |
| 2942 | "mail/save.xpm" | ||
| 2943 | nil t)) | ||
| 2944 | (image-load-path (cons (car load-path) image-load-path)) | 2942 | (image-load-path (cons (car load-path) image-load-path)) |
| 2945 | (map (gmm-tool-bar-from-list gnus-summary-tool-bar | 2943 | (map (gmm-tool-bar-from-list gnus-summary-tool-bar |
| 2946 | gnus-summary-tool-bar-zap-list | 2944 | gnus-summary-tool-bar-zap-list |
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index f570ff4b065..51b6c93783d 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el | |||
| @@ -7902,9 +7902,8 @@ When FORCE, rebuild the tool bar." | |||
| 7902 | (or (not message-tool-bar-map) force)) | 7902 | (or (not message-tool-bar-map) force)) |
| 7903 | (setq message-tool-bar-map | 7903 | (setq message-tool-bar-map |
| 7904 | (let* ((load-path | 7904 | (let* ((load-path |
| 7905 | (gmm-image-load-path-for-library "message" | 7905 | (image-load-path-for-library |
| 7906 | "mail/save-draft.xpm" | 7906 | "message" "mail/save-draft.xpm" nil t)) |
| 7907 | nil t)) | ||
| 7908 | (image-load-path (cons (car load-path) image-load-path))) | 7907 | (image-load-path (cons (car load-path) image-load-path))) |
| 7909 | (gmm-tool-bar-from-list message-tool-bar | 7908 | (gmm-tool-bar-from-list message-tool-bar |
| 7910 | message-tool-bar-zap-list | 7909 | message-tool-bar-zap-list |