summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJambunathan K <kjambunathan@gmail.com>2012-07-19 19:29:24 +0530
committerJambunathan K <kjambunathan@gmail.com>2012-07-19 19:29:24 +0530
commitf4148cf525a073de275e772d4a834ea2e219421d (patch)
treec90564e9a6e7ab2e025988fe41d73210b5f18d09
parent070e03011d0c1fc4d8fcd22fe108e1b606e68f15 (diff)
parent16d23c07dd3697db790b14e6873c65404c912e3f (diff)
downloadorg-mode-f4148cf525a073de275e772d4a834ea2e219421d.tar.gz
Merge origin/maint
-rw-r--r--lisp/org-compat.el9
-rw-r--r--lisp/org-odt.el50
2 files changed, 34 insertions, 25 deletions
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 51461e8..b24cd90 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -438,10 +438,13 @@ With two arguments, return floor and remainder of their quotient."
(funcall 'switch-to-buffer buffer-or-name norecord)))
;; `condition-case-unless-debug' has been introduced in Emacs 24.1
+;; `condition-case-no-debug' has been introduced in Emacs 23.1
(defalias 'org-condition-case-unless-debug
- (if (fboundp 'condition-case-unless-debug)
- 'condition-case-unless-debug
- 'condition-case-no-debug))
+ (or (and (fboundp 'condition-case-unless-debug)
+ 'condition-case-unless-debug)
+ (and (fboundp 'condition-case-no-debug)
+ 'condition-case-no-debug)
+ 'condition-case))
(defmacro org-check-version ()
"Try very hard to provide sensible version strings."
diff --git a/lisp/org-odt.el b/lisp/org-odt.el
index e24c8a5..3d19ca8 100644
--- a/lisp/org-odt.el
+++ b/lisp/org-odt.el
@@ -2031,31 +2031,37 @@ ATTR is a string of other attributes of the a element."
"Limiting dimensions for an embedded image.")
(defun org-odt-do-image-size (probe-method file &optional dpi anchor-type)
- (setq dpi (or dpi org-export-odt-pixels-per-inch))
- (setq anchor-type (or anchor-type "paragraph"))
- (flet ((size-in-cms (size-in-pixels)
- (flet ((pixels-to-cms (pixels)
- (let* ((cms-per-inch 2.54)
- (inches (/ pixels dpi)))
- (* cms-per-inch inches))))
- (and size-in-pixels
- (cons (pixels-to-cms (car size-in-pixels))
- (pixels-to-cms (cdr size-in-pixels)))))))
+ (let* ((dpi (or dpi org-export-odt-pixels-per-inch))
+ (anchor-type (or anchor-type "paragraph"))
+ (--pixels-to-cms
+ (function
+ (lambda (pixels dpi)
+ (let* ((cms-per-inch 2.54)
+ (inches (/ pixels dpi)))
+ (* cms-per-inch inches)))))
+ (--size-in-cms
+ (function
+ (lambda (size-in-pixels dpi)
+ (and size-in-pixels
+ (cons (funcall --pixels-to-cms (car size-in-pixels) dpi)
+ (funcall --pixels-to-cms (cdr size-in-pixels) dpi)))))))
(case probe-method
(emacs
- (size-in-cms (ignore-errors ; Emacs could be in batch mode
- (clear-image-cache)
- (image-size (create-image file) 'pixels))))
+ (let ((size-in-pixels
+ (ignore-errors ; Emacs could be in batch mode
+ (clear-image-cache)
+ (image-size (create-image file) 'pixels))))
+ (funcall --size-in-cms size-in-pixels dpi)))
(imagemagick
- (size-in-cms
- (let ((dim (shell-command-to-string
- (format "identify -format \"%%w:%%h\" \"%s\"" file))))
- (when (string-match "\\([0-9]+\\):\\([0-9]+\\)" dim)
- (cons (string-to-number (match-string 1 dim))
- (string-to-number (match-string 2 dim)))))))
- (t
- (cdr (assoc-string anchor-type
- org-export-odt-default-image-sizes-alist))))))
+ (let ((size-in-pixels
+ (let ((dim (shell-command-to-string
+ (format "identify -format \"%%w:%%h\" \"%s\"" file))))
+ (when (string-match "\\([0-9]+\\):\\([0-9]+\\)" dim)
+ (cons (string-to-number (match-string 1 dim))
+ (string-to-number (match-string 2 dim)))))))
+ (funcall --size-in-cms size-in-pixels dpi)))
+ (t (cdr (assoc-string anchor-type
+ org-export-odt-default-image-sizes-alist))))))
(defun org-odt-image-size-from-file (file &optional user-width
user-height scale dpi embed-as)