commit 2755cf1848b551436b9cc2eff6e4b882b10c07aa (HEAD, refs/remotes/origin/master) Author: YAMAMOTO Mitsuharu Date: Wed Mar 27 11:04:46 2019 +0900 Support native image resizing on cairo * src/xterm.c (x_cr_draw_image): Add arguments image_width and image_height and support scaling. All callers changed. * src/image.c (Fimage_scaling_p): Return t when USE_CAIRO. (x_set_image_size) [USE_CAIRO]: Record the scaled dimensions in the image struct. * src/dispextern.h (HAVE_NATIVE_SCALING): Define when USE_CAIRO as well. * etc/NEWS: Update the announcement of native image scaling. diff --git a/etc/NEWS b/etc/NEWS index 71127ac725..7486d6bcfe 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1718,9 +1718,9 @@ the process. That way 'make-process' can start remote processes. +++ ** Emacs now supports resizing (scaling) of images without ImageMagick. All modern systems are supported by this feature. (On GNU and Unix -systems, the XRender extension to X11 is required for this to be -available; the configure script will test for it and, if found, enable -scaling.) +systems, Cairo drawing or the XRender extension to X11 is required for +this to be available; the configure script will test for it and, if +found, enable scaling.) The new function 'image-scaling-p' can be used to test whether any given frame supports resizing. diff --git a/src/dispextern.h b/src/dispextern.h index 4d96e51d73..1a53656353 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2938,7 +2938,7 @@ struct redisplay_interface #ifdef HAVE_WINDOW_SYSTEM -# if defined HAVE_XRENDER || defined HAVE_NS || defined HAVE_NTGUI +# if defined USE_CAIRO || defined HAVE_XRENDER || defined HAVE_NS || defined HAVE_NTGUI # define HAVE_NATIVE_SCALING # endif diff --git a/src/image.c b/src/image.c index 16c5978db6..6e415ef1f7 100644 --- a/src/image.c +++ b/src/image.c @@ -1878,7 +1878,10 @@ x_set_image_size (struct frame *f, struct image *img) img->height = height; # endif -# ifdef HAVE_XRENDER +# ifdef USE_CAIRO + img->width = width; + img->height = height; +# elif defined HAVE_XRENDER if (img->picture) { double xscale = img->width / (double) width; @@ -9918,7 +9921,7 @@ DEFUN ("image-scaling-p", Fimage_scaling_p, Simage_scaling_p, 0, 1, 0, Return t if FRAME supports native scaling, nil otherwise. */) (Lisp_Object frame) { -#if defined (HAVE_NS) || defined (HAVE_NTGUI) +#if defined (USE_CAIRO) || defined (HAVE_NS) || defined (HAVE_NTGUI) return Qt; #elif defined (HAVE_X_WINDOWS) && defined (HAVE_XRENDER) int event_basep, error_basep; diff --git a/src/xterm.c b/src/xterm.c index 33eb0f3b5e..f90d6713b0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -480,13 +480,12 @@ x_cr_destroy_fringe_bitmap (int which) static void x_cr_draw_image (struct frame *f, GC gc, cairo_surface_t *image, + int image_width, int image_height, int src_x, int src_y, int width, int height, int dest_x, int dest_y, bool overlay_p) { - cairo_t *cr; - cairo_format_t format; + cairo_t *cr = x_begin_cr_clip (f, gc); - cr = x_begin_cr_clip (f, gc); if (overlay_p) cairo_rectangle (cr, dest_x, dest_y, width, height); else @@ -495,18 +494,33 @@ x_cr_draw_image (struct frame *f, GC gc, cairo_surface_t *image, cairo_rectangle (cr, dest_x, dest_y, width, height); cairo_fill_preserve (cr); } - format = cairo_image_surface_get_format (image); + + int orig_image_width = cairo_image_surface_get_width (image); + if (image_width == 0) image_width = orig_image_width; + int orig_image_height = cairo_image_surface_get_height (image); + if (image_height == 0) image_height = orig_image_height; + + cairo_pattern_t *pattern = cairo_pattern_create_for_surface (image); + cairo_matrix_t matrix; + cairo_matrix_init_scale (&matrix, orig_image_width / (double) image_width, + orig_image_height / (double) image_height); + cairo_matrix_translate (&matrix, src_x - dest_x, src_y - dest_y); + cairo_pattern_set_matrix (pattern, &matrix); + + cairo_format_t format = cairo_image_surface_get_format (image); if (format != CAIRO_FORMAT_A8 && format != CAIRO_FORMAT_A1) { - cairo_set_source_surface (cr, image, dest_x - src_x, dest_y - src_y); + cairo_set_source (cr, pattern); cairo_fill (cr); } else { x_set_cr_source_with_gc_foreground (f, gc); cairo_clip (cr); - cairo_mask_surface (cr, image, dest_x - src_x, dest_y - src_y); + cairo_mask (cr, pattern); } + cairo_pattern_destroy (pattern); + x_end_cr_clip (f); } @@ -1430,7 +1444,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring : f->output_data.x->cursor_pixel) : face->foreground)); XSetBackground (display, gc, face->background); - x_cr_draw_image (f, gc, fringe_bmp[p->which], 0, p->dh, + x_cr_draw_image (f, gc, fringe_bmp[p->which], 0, 0, 0, p->dh, p->wd, p->h, p->x, p->y, p->overlay_p); XSetForeground (display, gc, gcv.foreground); XSetBackground (display, gc, gcv.background); @@ -3041,8 +3055,10 @@ x_draw_image_foreground (struct glyph_string *s) if (s->img->cr_data) { x_set_glyph_string_clipping (s); - x_cr_draw_image (s->f, s->gc, s->img->cr_data, s->slice.x, s->slice.y, - s->slice.width, s->slice.height, x, y, true); + x_cr_draw_image (s->f, s->gc, + s->img->cr_data, s->img->width, s->img->height, + s->slice.x, s->slice.y, s->slice.width, s->slice.height, + x, y, true); if (!s->img->mask) { /* When the image has a mask, we can expect that at commit d7e442651777805958bd6bcbc8312a6cce147e4a Author: YAMAMOTO Mitsuharu Date: Wed Mar 27 09:49:22 2019 +0900 Fix cairo image drawing with box * src/xterm.c (x_cr_draw_image): Don't call cr_clip for non-mask case. (x_draw_image_foreground) [USE_CAIRO]: Draw image here ... (x_draw_image_glyph_string) [USE_CAIRO]: ... instead of here. (x_draw_image_foreground, x_draw_image_foreground_1) (x_draw_image_glyph_string) [USE_CAIRO]: Ifdef away unused code path. diff --git a/src/xterm.c b/src/xterm.c index f349e99d51..33eb0f3b5e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -495,7 +495,6 @@ x_cr_draw_image (struct frame *f, GC gc, cairo_surface_t *image, cairo_rectangle (cr, dest_x, dest_y, width, height); cairo_fill_preserve (cr); } - cairo_clip (cr); format = cairo_image_surface_get_format (image); if (format != CAIRO_FORMAT_A8 && format != CAIRO_FORMAT_A1) { @@ -505,6 +504,7 @@ x_cr_draw_image (struct frame *f, GC gc, cairo_surface_t *image, else { x_set_cr_source_with_gc_foreground (f, gc); + cairo_clip (cr); cairo_mask_surface (cr, image, dest_x - src_x, dest_y - src_y); } x_end_cr_clip (f); @@ -1511,7 +1511,9 @@ static void x_setup_relief_colors (struct glyph_string *); static void x_draw_image_glyph_string (struct glyph_string *); static void x_draw_image_relief (struct glyph_string *); static void x_draw_image_foreground (struct glyph_string *); +#ifndef USE_CAIRO static void x_draw_image_foreground_1 (struct glyph_string *, Pixmap); +#endif static void x_clear_glyph_string_rect (struct glyph_string *, int, int, int, int); static void x_draw_relief_rect (struct frame *, int, int, int, int, @@ -3035,6 +3037,30 @@ x_draw_image_foreground (struct glyph_string *s) if (s->slice.y == 0) y += s->img->vmargin; +#ifdef USE_CAIRO + if (s->img->cr_data) + { + x_set_glyph_string_clipping (s); + x_cr_draw_image (s->f, s->gc, s->img->cr_data, s->slice.x, s->slice.y, + s->slice.width, s->slice.height, x, y, true); + if (!s->img->mask) + { + /* When the image has a mask, we can expect that at + least part of a mouse highlight or a block cursor will + be visible. If the image doesn't have a mask, make + a block cursor visible by drawing a rectangle around + the image. I believe it's looking better if we do + nothing here for mouse-face. */ + if (s->hl == DRAW_CURSOR) + { + int relief = eabs (s->img->relief); + x_draw_rectangle (s->f, s->gc, x - relief, y - relief, + s->slice.width + relief*2 - 1, + s->slice.height + relief*2 - 1); + } + } + } +#else /* ! USE_CAIRO */ if (s->img->pixmap) { if (s->img->mask) @@ -3095,6 +3121,7 @@ x_draw_image_foreground (struct glyph_string *s) } } } +#endif /* ! USE_CAIRO */ else /* Draw a rectangle if image could not be loaded. */ x_draw_rectangle (s->f, s->gc, x, y, @@ -3177,6 +3204,7 @@ x_draw_image_relief (struct glyph_string *s) } +#ifndef USE_CAIRO /* Draw the foreground of image glyph string S to PIXMAP. */ static void @@ -3249,6 +3277,7 @@ x_draw_image_foreground_1 (struct glyph_string *s, Pixmap pixmap) x_draw_rectangle (s->f, s->gc, x, y, s->slice.width - 1, s->slice.height - 1); } +#endif /* ! USE_CAIRO */ /* Draw part of the background of glyph string S. X, Y, W, and H @@ -3308,6 +3337,7 @@ x_draw_image_glyph_string (struct glyph_string *s) || s->img->pixmap == 0 || s->width != s->background_width) { +#ifndef USE_CAIRO if (s->img->mask) { /* Create a pixmap as large as the glyph string. Fill it @@ -3348,6 +3378,7 @@ x_draw_image_glyph_string (struct glyph_string *s) } } else +#endif /* ! USE_CAIRO */ { int x = s->x; int y = s->y; @@ -3370,25 +3401,8 @@ x_draw_image_glyph_string (struct glyph_string *s) } /* Draw the foreground. */ -#ifdef USE_CAIRO - if (s->img->cr_data) - { - cairo_t *cr = x_begin_cr_clip (s->f, s->gc); - - int x = s->x + s->img->hmargin; - int y = s->y + s->img->vmargin; - int width = s->background_width; - - cairo_set_source_surface (cr, s->img->cr_data, - x - s->slice.x, - y - s->slice.y); - cairo_rectangle (cr, x, y, width, height); - cairo_fill (cr); - x_end_cr_clip (s->f); - } - else -#endif - if (pixmap != None) +#ifndef USE_CAIRO + if (pixmap != None) { x_draw_image_foreground_1 (s, pixmap); x_set_glyph_string_clipping (s); @@ -3397,6 +3411,7 @@ x_draw_image_glyph_string (struct glyph_string *s) XFreePixmap (s->display, pixmap); } else +#endif /* ! USE_CAIRO */ x_draw_image_foreground (s); /* If we must draw a relief around the image, do it. */ commit 5d6a314475704f3fbdb29f68c6929516230e8a98 Author: Paul Eggert Date: Tue Mar 26 19:06:36 2019 -0700 2019-03-26 regex cleanup Problems reported by Mattias Engdegård in: https://lists.gnu.org/r/emacs-devel/2019-03/msg01028.html * lisp/align.el (align-rules-list): * lisp/speedbar.el (speedbar-check-read-only, speedbar-check-vc): * lisp/vc/diff-mode.el (diff-add-change-log-entries-other-window): * lisp/woman.el (woman-parse-numeric-arg): Put "-" at end of character alternatives, since a range was not intended. * lisp/erc/erc.el (font-lock): * lisp/mail/footnote.el (cl-seq): Avoid duplicate character alternatives by using cl-seq API. * lisp/mail/footnote.el (footnote--current-regexp): * lisp/textmodes/css-mode.el (css--font-lock-keywords): Avoid repetition of repetition. * lisp/net/webjump.el (webjump-url-encode): Add ~ to character alternatives, and rewrite confusing range. * lisp/progmodes/verilog-mode.el (verilog-compiler-directives) (verilog-assignment-operator-re): Remove duplicate. * lisp/progmodes/verilog-mode.el (verilog-preprocessor-re): * lisp/textmodes/css-mode.el (css--font-lock-keywords): Don’t escape a char that doesn’t need it. * lisp/textmodes/picture.el (picture-tab-chars): In docstring, do not say regexp characters will be quoted; merely say in another way that the syntax is that of character alternatives. (picture-set-tab-stops, picture-tab-search): Don’t attempt to regexp-quote picture-tab-chars. (picture-tab-search): Quote \ in picture-tab-chars for skip-chars-backwards, which treats \ differently than regexp character alternatives do. diff --git a/lisp/align.el b/lisp/align.el index a81498be5d..fd88d0eda4 100644 --- a/lisp/align.el +++ b/lisp/align.el @@ -438,7 +438,7 @@ The possible settings for `align-region-separate' are: (tab-stop . nil)) (perl-assignment - (regexp . ,(concat "[^=!^&*-+<>/| \t\n]\\(\\s-*\\)=[~>]?" + (regexp . ,(concat "[^=!^&*+<>/| \t\n-]\\(\\s-*\\)=[~>]?" "\\(\\s-*\\)\\([^>= \t\n]\\|$\\)")) (group . (1 2)) (modes . align-perl-modes) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index bcaa3e4525..e34487de27 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -67,6 +67,7 @@ (load "erc-loaddefs" nil t) (eval-when-compile (require 'cl-lib)) +(require 'cl-seq) (require 'font-lock) (require 'pp) (require 'thingatpt) @@ -2522,10 +2523,8 @@ Returns NICK unmodified unless `erc-lurker-trim-nicks' is non-nil." (if erc-lurker-trim-nicks (replace-regexp-in-string - (format "[%s]" - (mapconcat (lambda (char) - (regexp-quote (char-to-string char))) - erc-lurker-ignore-chars "")) + (regexp-opt (cl-delete-duplicates + (mapcar #'char-to-string erc-lurker-ignore-chars))) "" nick) nick)) diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el index a7802929dc..7f88e30120 100644 --- a/lisp/mail/footnote.el +++ b/lisp/mail/footnote.el @@ -64,6 +64,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(require 'cl-seq) (defvar filladapt-token-table) (defgroup footnote nil @@ -363,7 +364,9 @@ Use Unicode characters for footnoting." ("ק" "ר" "ש" "ת" "תק" "תר" "תש" "תת" "תתק"))) (defconst footnote-hebrew-numeric-regex - (concat "[" (apply #'concat (apply #'append footnote-hebrew-numeric)) "']+")) + (concat "[" (cl-delete-duplicates + (apply #'concat (apply #'append footnote-hebrew-numeric))) + "']+")) ;; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?") (defun footnote--hebrew-numeric (n) @@ -457,9 +460,14 @@ Conversion is done based upon the current selected style." (defun footnote--current-regexp () "Return the regexp of the index of the current style." - (concat (nth 2 (or (assq footnote-style footnote-style-alist) - (nth 0 footnote-style-alist))) - "*")) + (let ((regexp (nth 2 (or (assq footnote-style footnote-style-alist) + (nth 0 footnote-style-alist))))) + (concat + ;; Hack to avoid repetition of repetition. + (if (string-match "[^\\]\\\\\\{2\\}*[*+?]\\'" regexp) + (substring regexp 0 -1) + regexp) + "*"))) (defun footnote--refresh-footnotes (&optional index-regexp) "Redraw all footnotes. diff --git a/lisp/net/webjump.el b/lisp/net/webjump.el index 40df23e174..e297b9d610 100644 --- a/lisp/net/webjump.el +++ b/lisp/net/webjump.el @@ -342,7 +342,7 @@ Please submit bug reports and other feedback to the author, Neil W. Van Dyke (mapconcat (lambda (c) (let ((s (char-to-string c))) (cond ((string= s " ") "+") - ((string-match "[a-zA-Z_.-/]" s) s) + ((string-match "[a-zA-Z_./~-]" s) s) (t (upcase (format "%%%02x" c)))))) (encode-coding-string str 'utf-8) "")) diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 9e241c70e7..f55cf0002d 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -2053,7 +2053,7 @@ find the errors." "`resetall" "`timescale" "`unconnected_drive" "`undef" "`undefineall" ;; compiler directives not covered by IEEE 1800 "`case" "`default" "`endfor" "`endprotect" "`endswitch" "`endwhile" "`for" - "`format" "`if" "`let" "`protect" "`switch" "`timescale" "`time_scale" + "`format" "`if" "`let" "`protect" "`switch" "`time_scale" "`while" )) "List of Verilog compiler directives.") @@ -2414,9 +2414,7 @@ find the errors." '( ;; blocking assignment_operator "=" "+=" "-=" "*=" "/=" "%=" "&=" "|=" "^=" "<<=" ">>=" "<<<=" ">>>=" - ;; non blocking assignment operator - "<=" - ;; comparison + ;; comparison (also nonblocking assignment "<=") "==" "!=" "===" "!==" "<=" ">=" "==?" "!=?" "<->" ;; event_trigger "->" "->>" @@ -2973,7 +2971,7 @@ find the errors." "\\<\\(`pragma\\)\\>\\s-+.+$" "\\)\\|\\(?:" ;; `timescale time_unit / time_precision - "\\<\\(`timescale\\)\\>\\s-+10\\{0,2\\}\\s-*[munpf]?s\\s-*\\/\\s-*10\\{0,2\\}\\s-*[munpf]?s" + "\\<\\(`timescale\\)\\>\\s-+10\\{0,2\\}\\s-*[munpf]?s\\s-*/\\s-*10\\{0,2\\}\\s-*[munpf]?s" "\\)\\|\\(?:" ;; `define and `if can span multiple lines if line ends in '\'. NOTE: `if is not IEEE 1800-2012 ;; from http://www.emacswiki.org/emacs/MultilineRegexp diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 399ef4557b..4823e4ba56 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -2849,7 +2849,7 @@ indicator, then do not add a space." (progn (goto-char speedbar-ro-to-do-point) (while (and (not (input-pending-p)) - (re-search-forward "^\\([0-9]+\\):\\s-*[[<][+-?][]>] " + (re-search-forward "^\\([0-9]+\\):\\s-*[[<][+?-][]>] " nil t)) (setq speedbar-ro-to-do-point (point)) (let ((f (speedbar-line-file))) @@ -2900,7 +2900,7 @@ to add more types of version control systems." (progn (goto-char speedbar-vc-to-do-point) (while (and (not (input-pending-p)) - (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+-?]\\] " + (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+?-]\\] " nil t)) (setq speedbar-vc-to-do-point (point)) (if (speedbar-check-vc-this-line (match-string 1)) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index cddcdc0947..57ecc9788e 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -892,7 +892,7 @@ cannot be completed sensibly: `custom-ident', (,(concat "@" css-ident-re) (0 font-lock-builtin-face)) ;; Selectors. ;; Allow plain ":root" as a selector. - ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\)*{" (1 'css-selector keep)) + ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\){" (1 'css-selector keep)) ;; FIXME: attribute selectors don't work well because they may contain ;; strings which have already been highlighted as f-l-string-face and ;; thus prevent this highlighting from being applied (actually now that @@ -915,7 +915,7 @@ cannot be completed sensibly: `custom-ident', "\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids css-pseudo-element-ids) t) - "\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)" + "\\|::" (regexp-opt css-pseudo-element-ids t) "\\)" "\\(?:([^)]+)\\)?" (if (not sassy) "[^:{}()\n]*" diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index f0e30135f1..b520849467 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -387,7 +387,8 @@ Interactively, ARG is the numeric argument, and defaults to 1." \\[picture-set-tab-stops] and \\[picture-tab-search]. The syntax for this variable is like the syntax used inside of `[...]' in a regular expression--but without the `[' and the `]'. -It is NOT a regular expression, any regexp special characters will be quoted. +It is NOT a regular expression, and should follow the usual +rules for the contents of a character alternative. It defines a set of \"interesting characters\" to look for when setting \(or searching for) tab stops, initially \"!-~\" (all printing characters). For example, suppose that you are editing a table which is formatted thus: @@ -425,7 +426,7 @@ stops computed are displayed in the minibuffer with `:' at each stop." (if arg (setq tabs (or (default-value 'tab-stop-list) (indent-accumulate-tab-stops (window-width)))) - (let ((regexp (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]"))) + (let ((regexp (concat "[ \t]+[" picture-tab-chars "]"))) (beginning-of-line) (let ((bol (point))) (end-of-line) @@ -433,8 +434,8 @@ stops computed are displayed in the minibuffer with `:' at each stop." (skip-chars-forward " \t") (setq tabs (cons (current-column) tabs))) (if (null tabs) - (error "No characters in set %s on this line" - (regexp-quote picture-tab-chars)))))) + (error "No characters in set [%s] on this line" + picture-tab-chars))))) (setq tab-stop-list tabs) (let ((blurb (make-string (1+ (nth (1- (length tabs)) tabs)) ?\ ))) (while tabs @@ -455,12 +456,13 @@ If no such character is found, move to beginning of line." (progn (beginning-of-line) (skip-chars-backward - (concat "^" (regexp-quote picture-tab-chars)) + (concat "^" (replace-regexp-in-string + "\\\\" "\\\\" picture-tab-chars nil t)) (point-min)) (not (bobp)))) (move-to-column target)) (if (re-search-forward - (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]") + (concat "[ \t]+[" picture-tab-chars "]") (line-end-position) 'move) (setq target (1- (current-column))) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index b67caab7f5..dbde284da8 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2213,7 +2213,7 @@ I.e. like `add-change-log-entry-other-window' but applied to all hunks." ;; `add-change-log-entry-other-window' works better in ;; that case. (re-search-forward - (concat "\n[!+-<>]" + (concat "\n[!+<>-]" ;; If the hunk is a context hunk with an empty first ;; half, recognize the "--- NNN,MMM ----" line "\\(-- [0-9]+\\(,[0-9]+\\)? ----\n" diff --git a/lisp/woman.el b/lisp/woman.el index a351f788ec..39d9b806d2 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -3511,7 +3511,7 @@ The expression may be an argument in quotes." (let ((value (if (looking-at "[+-]") 0 (woman-parse-numeric-value))) op) (while (cond - ((looking-at "[+-/*%]") ; arithmetic operators + ((looking-at "[+/*%-]") ; arithmetic operators (forward-char) (setq op (intern-soft (match-string 0))) (setq value (funcall op value (woman-parse-numeric-value)))) commit c8ec3108a3d0bd1955d21f40b3c0c3b36d55b20d Author: Stefan Monnier Date: Tue Mar 26 11:45:07 2019 -0400 * easy-mmode.el: simplify via custom-current-group * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Don't try and guess a default :group, defcustom does it better anyway. diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 8ac0a1d593..be531aab84 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -411,12 +411,6 @@ on if the hook has explicitly disabled it." (:global (setq keys (cdr keys))) (_ (push keyw extra-keywords) (push (pop keys) extra-keywords)))) - (unless group - ;; We might as well provide a best-guess default group. - (setq group - `(:group ',(intern (replace-regexp-in-string - "-mode\\'" "" (symbol-name mode)))))) - `(progn (progn :autoload-end commit ae68fad033261eb63e3d2221c946f9b03b5464ac Author: YAMAMOTO Mitsuharu Date: Tue Mar 26 18:58:35 2019 +0900 Use cairo image surface instead of pattern for fringe bitmap * src/xterm.c (fringe_bmp, x_cr_define_fringe_bitmap) (x_cr_destroy_fringe_bitmap, x_cr_draw_image) [USE_CAIRO]: Change type of fringe bitmap. diff --git a/src/xterm.c b/src/xterm.c index e3034772a4..f349e99d51 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -426,7 +426,7 @@ x_set_cr_source_with_gc_background (struct frame *f, GC gc) /* Fringe bitmaps. */ static int max_fringe_bmp = 0; -static cairo_pattern_t **fringe_bmp = 0; +static cairo_surface_t **fringe_bmp = 0; static void x_cr_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd) @@ -434,13 +434,12 @@ x_cr_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd) int i, stride; cairo_surface_t *surface; unsigned char *data; - cairo_pattern_t *pattern; if (which >= max_fringe_bmp) { i = max_fringe_bmp; max_fringe_bmp = which + 20; - fringe_bmp = (cairo_pattern_t **) xrealloc (fringe_bmp, max_fringe_bmp * sizeof (cairo_pattern_t *)); + fringe_bmp = xrealloc (fringe_bmp, max_fringe_bmp * sizeof (*fringe_bmp)); while (i < max_fringe_bmp) fringe_bmp[i++] = 0; } @@ -458,12 +457,10 @@ x_cr_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd) } cairo_surface_mark_dirty (surface); - pattern = cairo_pattern_create_for_surface (surface); - cairo_surface_destroy (surface); unblock_input (); - fringe_bmp[which] = pattern; + fringe_bmp[which] = surface; } static void @@ -475,20 +472,18 @@ x_cr_destroy_fringe_bitmap (int which) if (fringe_bmp[which]) { block_input (); - cairo_pattern_destroy (fringe_bmp[which]); + cairo_surface_destroy (fringe_bmp[which]); unblock_input (); } fringe_bmp[which] = 0; } static void -x_cr_draw_image (struct frame *f, GC gc, cairo_pattern_t *image, +x_cr_draw_image (struct frame *f, GC gc, cairo_surface_t *image, int src_x, int src_y, int width, int height, int dest_x, int dest_y, bool overlay_p) { cairo_t *cr; - cairo_matrix_t matrix; - cairo_surface_t *surface; cairo_format_t format; cr = x_begin_cr_clip (f, gc); @@ -501,19 +496,16 @@ x_cr_draw_image (struct frame *f, GC gc, cairo_pattern_t *image, cairo_fill_preserve (cr); } cairo_clip (cr); - cairo_matrix_init_translate (&matrix, src_x - dest_x, src_y - dest_y); - cairo_pattern_set_matrix (image, &matrix); - cairo_pattern_get_surface (image, &surface); - format = cairo_image_surface_get_format (surface); + format = cairo_image_surface_get_format (image); if (format != CAIRO_FORMAT_A8 && format != CAIRO_FORMAT_A1) { - cairo_set_source (cr, image); + cairo_set_source_surface (cr, image, dest_x - src_x, dest_y - src_y); cairo_fill (cr); } else { x_set_cr_source_with_gc_foreground (f, gc); - cairo_mask (cr, image); + cairo_mask_surface (cr, image, dest_x - src_x, dest_y - src_y); } x_end_cr_clip (f); }