aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-10-20 21:35:30 -0400
committerStefan Monnier2014-10-20 21:35:30 -0400
commit80aabe42436b909018c98a8a87ccbe614e72ef25 (patch)
treec7e360b9c89645e9fe65a69f87a9b469b1c0c213
parente538605e4cbc504a0481b2aad0eaf7b9529294d3 (diff)
downloademacs-80aabe42436b909018c98a8a87ccbe614e72ef25.tar.gz
emacs-80aabe42436b909018c98a8a87ccbe614e72ef25.zip
* lisp/net/newst-reader.el (newsticker--image-read): Simplify.
(newsticker--icon-read): Use dolist and fix free var error.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/net/newst-reader.el64
2 files changed, 33 insertions, 34 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6e40eab2c18..4608ed3aabe 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12014-10-21 Stefan Monnier <monnier@iro.umontreal.ca> 12014-10-21 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * net/newst-reader.el (newsticker--image-read): Simplify.
4 (newsticker--icon-read): Use dolist and fix free var error.
5
3 * imenu.el (imenu--menubar-keymap): New var. 6 * imenu.el (imenu--menubar-keymap): New var.
4 (imenu-add-to-menubar): Set it to remember the keymap we used. 7 (imenu-add-to-menubar): Set it to remember the keymap we used.
5 (imenu-update-menubar): Use it instead of asking lookup-key. 8 (imenu-update-menubar): Use it instead of asking lookup-key.
diff --git a/lisp/net/newst-reader.el b/lisp/net/newst-reader.el
index fcf4d19503e..e639ffd4514 100644
--- a/lisp/net/newst-reader.el
+++ b/lisp/net/newst-reader.el
@@ -262,50 +262,46 @@ If DISABLED is non-nil the image will be converted to a disabled look
262Optional argument MAX-HEIGHT specifies the maximal image height. 262Optional argument MAX-HEIGHT specifies the maximal image height.
263Return the image." 263Return the image."
264 (let ((image-name (concat (newsticker--images-dir) 264 (let ((image-name (concat (newsticker--images-dir)
265 (symbol-name feed-name-symbol))) 265 (symbol-name feed-name-symbol))))
266 (img nil))
267 (when (file-exists-p image-name) 266 (when (file-exists-p image-name)
268 (condition-case error-data 267 (condition-case error-data
269 (setq img (create-image 268 (create-image
270 image-name 269 image-name
271 (and (fboundp 'imagemagick-types) 270 (and (fboundp 'imagemagick-types)
272 (imagemagick-types) 271 (imagemagick-types)
273 'imagemagick) 272 'imagemagick)
274 nil 273 nil
275 :conversion (and newsticker-enable-logo-manipulations 274 :conversion (and newsticker-enable-logo-manipulations
276 disabled 275 disabled
277 'disabled) 276 'disabled)
278 :mask (and newsticker-enable-logo-manipulations 277 :mask (and newsticker-enable-logo-manipulations
279 'heuristic) 278 'heuristic)
280 :ascent 100 279 :ascent 100
281 :max-height max-height)) 280 :max-height max-height)
282 (error 281 (error
283 (message "Error: cannot create image for %s: %s" 282 (message "Error: cannot create image for %s: %s"
284 feed-name-symbol error-data)))) 283 feed-name-symbol error-data))))))
285 img))
286 284
287(defun newsticker--icon-read (feed-name-symbol) 285(defun newsticker--icon-read (feed-name-symbol)
288 "Read the cached icon for FEED-NAME-SYMBOL from disk. 286 "Read the cached icon for FEED-NAME-SYMBOL from disk.
289Return the image." 287Return the image."
290 (catch 'icon 288 (catch 'icon
291 (when (file-exists-p (newsticker--icons-dir)) 289 (when (file-exists-p (newsticker--icons-dir))
292 (mapc (lambda (file) 290 (dolist (file (directory-files (newsticker--icons-dir) t
293 (condition-case error-data 291 (concat (symbol-name feed-name-symbol) "\\..*")))
294 (progn (setq img (create-image 292 (condition-case error-data
295 file (and (fboundp 'imagemagick-types) 293 (throw 'icon (create-image
296 (imagemagick-types) 294 file (and (fboundp 'imagemagick-types)
297 'imagemagick) 295 (imagemagick-types)
298 nil 296 'imagemagick)
299 :ascent 'center 297 nil
300 :max-width 16 298 :ascent 'center
301 :max-height 16)) 299 :max-width 16
302 (throw 'icon img)) 300 :max-height 16))
303 (error 301 (error
304 (message "Error: cannot create icon for %s: %s" 302 (message "Error: cannot create icon for %s: %s"
305 feed-name-symbol error-data)))) 303 feed-name-symbol error-data)))))
306 (directory-files (newsticker--icons-dir) t 304 ;; Fallback: default icon.
307 (concat (symbol-name feed-name-symbol) "\\..*"))))
308 ;; fallback: default icon
309 (find-image '((:type png :file "newsticker/rss-feed.png" :ascent center))))) 305 (find-image '((:type png :file "newsticker/rss-feed.png" :ascent center)))))
310 306
311;; the functions we need for retrieval and display 307;; the functions we need for retrieval and display