Merge from trunk.

This commit is contained in:
Paul Eggert 2012-04-15 23:40:21 -07:00
commit 5927b310c8
7 changed files with 82 additions and 43 deletions

View file

@ -42,6 +42,14 @@ been adding them there, put them somewhere else, eg site-lisp.
** If your Emacs was built from a bzr checkout, the new variable
`emacs-bzr-version' contains information about which bzr revision was used.
** ImageMagick support, if available, is automatically enabled.
It is no longer necessary to call `imagemagick-register-types'
explicitly to install ImageMagick image types; that function is called
automatically when setting `imagemagick-types-inhibit'.
*** Setting `imagemagick-types-inhibit' to t now disables the use of
ImageMagick to view images, set
* Editing Changes in Emacs 24.2

View file

@ -1,3 +1,16 @@
2012-04-16 Chong Yidong <cyd@gnu.org>
* image.el (imagemagick--extension-regexp): New variable.
(imagemagick-register-types): Use it.
(imagemagick-types-inhibit): Add :set function. Allow new value
of t to inhibit all types.
* emacs-lisp/regexp-opt.el (regexp-opt-charset): Avoid cl macros,
so we can preload it.
* loadup.el (fboundp): Preload regexp-opt, needed by
imagemagick-register-types.
2012-04-15 Chong Yidong <cyd@gnu.org>
* frame.el (scrolling): Remove nearly unused customization group.

View file

@ -136,9 +136,6 @@ This means the number of non-shy regexp grouping constructs
;;; Workhorse functions.
(eval-when-compile
(require 'cl))
(defun regexp-opt-group (strings &optional paren lax)
"Return a regexp to match a string in the sorted list STRINGS.
If PAREN non-nil, output regexp parentheses around returned regexp.
@ -248,15 +245,15 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
;;
;; Make a character map but extract character set meta characters.
(dolist (char chars)
(case char
(?\]
(setq bracket "]"))
(?^
(setq caret "^"))
(?-
(setq dash "-"))
(otherwise
(aset charmap char t))))
(cond
((eq char ?\])
(setq bracket "]"))
((eq char ?^)
(setq caret "^"))
((eq char ?-)
(setq dash "-"))
(t
(aset charmap char t))))
;;
;; Make a character set from the map using ranges where applicable.
(map-char-table
@ -268,14 +265,14 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
(setq charset (format "%s%c-%c" charset start end))
(while (>= end start)
(setq charset (format "%s%c" charset start))
(incf start)))
(setq start (1+ start))))
(setq start (car c) end (cdr c)))
(if (= (1- c) end) (setq end c)
(if (> end (+ start 2))
(setq charset (format "%s%c-%c" charset start end))
(while (>= end start)
(setq charset (format "%s%c" charset start))
(incf start)))
(setq start (1+ start))))
(setq start c end c)))))
charmap)
(when (>= end start)
@ -283,7 +280,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
(setq charset (format "%s%c-%c" charset start end))
(while (>= end start)
(setq charset (format "%s%c" charset start))
(incf start))))
(setq start (1+ start)))))
;;
;; Make sure a caret is not first and a dash is first or last.
(if (and (string-equal charset "") (string-equal bracket ""))

View file

@ -685,26 +685,16 @@ The minimum delay between successive frames is 0.01s."
image n count time-elapsed limit))))
(defcustom imagemagick-types-inhibit
'(C HTML HTM TXT PDF)
"ImageMagick types that should not be visited in Image mode.
This should be a list of symbols, each of which should be one of
the ImageMagick types listed in `imagemagick-types'. These image
types are not registered by `imagemagick-register-types'.
If Emacs is compiled without ImageMagick support, this variable
has no effect."
:type '(choice (const :tag "Let ImageMagick handle all types it can" nil)
(repeat symbol))
;; Ideally, would have a :set function that checks if we already did
;; imagemagick-register-types, and if so undoes it, then redoes it.
:version "24.1"
:group 'image)
(defvar imagemagick--file-regexp nil
"File extension regexp for ImageMagick files, if any.
This is the extension installed into `auto-mode-alist' and
`image-type-file-name-regexps' by `imagemagick-register-types'.")
;;;###autoload
(defun imagemagick-register-types ()
"Register file types that can be handled by ImageMagick.
This registers the ImageMagick types listed in `imagemagick-types',
This function is called at startup, after loading the init file.
It registers the ImageMagick types listed in `imagemagick-types',
excluding those listed in `imagemagick-types-inhibit'.
Registered image types are added to `auto-mode-alist', so that
@ -714,14 +704,45 @@ recognizes these files as having image type `imagemagick'.
If Emacs is compiled without ImageMagick support, do nothing."
(when (fboundp 'imagemagick-types)
(let ((im-types '()))
(dolist (im-type (imagemagick-types))
(unless (memq im-type imagemagick-types-inhibit)
(push (downcase (symbol-name im-type)) im-types)))
(let ((extension (concat "\\." (regexp-opt im-types) "\\'")))
(push (cons extension 'image-mode) auto-mode-alist)
(push (cons extension 'imagemagick)
image-type-file-name-regexps)))))
(let ((re (if (eq imagemagick-types-inhibit t)
;; Use a bogus regexp to inhibit matches.
"\\'a"
(let ((types))
(dolist (type (imagemagick-types))
(unless (memq type imagemagick-types-inhibit)
(push (downcase (symbol-name type)) types)))
(concat "\\." (regexp-opt types) "\\'"))))
(ama-elt (car (member (cons imagemagick--file-regexp 'image-mode)
auto-mode-alist)))
(itfnr-elt (car (member (cons imagemagick--file-regexp 'imagemagick)
image-type-file-name-regexps))))
(if ama-elt
(setcar ama-elt re)
(push (cons re 'image-mode) auto-mode-alist))
(if itfnr-elt
(setcar itfnr-elt re)
(push (cons re 'imagemagick) image-type-file-name-regexps))
(setq imagemagick--file-regexp re))))
(defcustom imagemagick-types-inhibit
'(C HTML HTM TXT PDF)
"List of ImageMagick types that should not be treated as images.
This should be a list of symbols, each of which should be one of
the ImageMagick types listed in `imagemagick-types'. The listed
image types are not registered by `imagemagick-register-types'.
If the value is t, inhibit the use of ImageMagick for images.
If Emacs is compiled without ImageMagick support, this variable
has no effect."
:type '(choice (const :tag "Support all ImageMagick types" nil)
(const :tag "Disable all ImageMagick types" t)
(repeat symbol))
:set (lambda (symbol value)
(set-default symbol value)
(imagemagick-register-types))
:version "24.1"
:group 'image)
(provide 'image)

View file

@ -193,6 +193,8 @@
(if (fboundp 'x-create-frame)
(progn
(load "fringe")
;; Needed by `imagemagick-register-types'
(load "emacs-lisp/regexp-opt")
(load "image")
(load "international/fontset")
(load "dnd")

View file

@ -8,6 +8,7 @@
GC_MALLOC_CHECK) && GC_MALLOC_CHECK), to match when it's used.
(NEED_MEM_INSERT): New macro.
(mem_insert, mem_insert_fixup) [!NEED_MEM_INSERT]: Remove; unused.
Remove one incorrect comment and fix another.
Fix minor ralloc.c problems found by static checking.
See http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html

View file

@ -948,9 +948,6 @@ lisp_free (POINTER_TYPE *block)
/* The entry point is lisp_align_malloc which returns blocks of at most
BLOCK_BYTES and guarantees they are aligned on a BLOCK_ALIGN boundary. */
/* Use posix_memalloc if the system has it and we're using the system's
malloc (because our gmalloc.c routines don't have posix_memalign although
its memalloc could be used). */
#if defined (HAVE_POSIX_MEMALIGN) && defined (SYSTEM_MALLOC)
#define USE_POSIX_MEMALIGN 1
#endif
@ -1007,7 +1004,7 @@ struct ablocks
struct ablock blocks[ABLOCKS_SIZE];
};
/* Size of the block requested from malloc or memalign. */
/* Size of the block requested from malloc or posix_memalign. */
#define ABLOCKS_BYTES (sizeof (struct ablocks) - BLOCK_PADDING)
#define ABLOCK_ABASE(block) \