From 3fd3e736934750c8b0e73b8327f0b75d3b09bf78 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 26 Mar 2014 10:55:31 -0700 Subject: [PATCH 1/6] More backward-compatible fix to char-equal core dump. * editfns.c (Fchar_equal): In unibyte buffers, assume values in range 128-255 are raw bytes. Suggested by Eli Zaretskii. Fixes: debbugs:17011 --- src/ChangeLog | 6 +++++- src/editfns.c | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index bf27ece6af7..025ea45b23b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,8 @@ -2014-03-26 Paul Eggert +2014-03-26 Paul Eggert + + More backward-compatible fix to char-equal core dump (Bug#17011). + * editfns.c (Fchar_equal): In unibyte buffers, assume values in + range 128-255 are raw bytes. Suggested by Eli Zaretskii. Fix core dump in char-equal (Bug#17011). * editfns.c (Fchar_equal): Do not use MAKE_CHAR_MULTIBYTE in diff --git a/src/editfns.c b/src/editfns.c index 1986ee53d23..9c1fcb0b790 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4377,13 +4377,23 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) if (NILP (BVAR (current_buffer, case_fold_search))) return Qnil; - /* FIXME: When enable-multibyte-characters is nil, it's still possible - to manipulate multibyte chars, which means there is a bug for chars - in the range 128-255 as we can't tell whether they are eight-bit - bytes or Latin-1 chars. For now, assume the latter. See Bug#17011. - Also see casefiddle.c's casify_object, which has a similar problem. */ i1 = XFASTINT (c1); i2 = XFASTINT (c2); + + /* FIXME: It is possible to compare multibyte characters even when + the current buffer is unibyte. Unfortunately this is ambiguous + for characters between 128 and 255, as they could be either + eight-bit raw bytes or Latin-1 characters. Assume the former for + now. See Bug#17011, and also see casefiddle.c's casify_object, + which has a similar problem. */ + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) + { + if (SINGLE_BYTE_CHAR_P (i1)) + i1 = UNIBYTE_TO_CHAR (i1); + if (SINGLE_BYTE_CHAR_P (i2)) + i2 = UNIBYTE_TO_CHAR (i2); + } + return (downcase (i1) == downcase (i2) ? Qt : Qnil); } From b1c870c9e8b8fd7001234d60fbb110c028c2f350 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 27 Mar 2014 01:20:50 +0100 Subject: [PATCH 2/6] lisp/emacs-lisp/package-x.el: Follow-up to change in package.el. (package--archive-contents-from-url): Use url-insert-file-contents; package-handle-response no longer exists. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/package-x.el | 18 ++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 468e83f4218..b0e3f041ec2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-03-27 Juanma Barranquero + + * emacs-lisp/package-x.el (package--archive-contents-from-url): + Use url-insert-file-contents; package-handle-response no longer exists. + 2014-03-26 Juanma Barranquero * emacs-lisp/package.el: Fix bug#16733 (again). diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el index 6a6a62dc916..1d9d1a04668 100644 --- a/lisp/emacs-lisp/package-x.el +++ b/lisp/emacs-lisp/package-x.el @@ -114,18 +114,12 @@ inserted after its first occurrence in the file." (defun package--archive-contents-from-url (archive-url) "Parse archive-contents file at ARCHIVE-URL. Return the file contents, as a string, or nil if unsuccessful." - (ignore-errors - (when archive-url - (let* ((buffer (url-retrieve-synchronously - (concat archive-url "archive-contents")))) - (set-buffer buffer) - (package-handle-response) - (re-search-forward "^$" nil 'move) - (forward-char) - (delete-region (point-min) (point)) - (prog1 (package-read-from-string - (buffer-substring-no-properties (point-min) (point-max))) - (kill-buffer buffer)))))) + (when archive-url + (with-temp-buffer + (ignore-errors + (url-insert-file-contents (concat archive-url "archive-contents")) + (package-read-from-string + (buffer-substring-no-properties (point-min) (point-max))))))) (defun package--archive-contents-from-file () "Parse the archive-contents at `package-archive-upload-base'" From 857ba6ec4622ba658788b8cd5805e8e9e8a5db16 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 27 Mar 2014 02:01:36 +0100 Subject: [PATCH 3/6] lisp/frameset.el: Fix bug#17046. (frameset--restore-frame): Remove workaround for bug#14795 which is no longer needed and causes trouble in GTK builds. --- lisp/ChangeLog | 3 +++ lisp/frameset.el | 8 +------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b0e3f041ec2..cb256740a03 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2014-03-27 Juanma Barranquero + * frameset.el (frameset--restore-frame): Remove workaround for bug#14795 + which is no longer needed and causes trouble in GTK builds (bug#17046). + * emacs-lisp/package-x.el (package--archive-contents-from-url): Use url-insert-file-contents; package-handle-response no longer exists. diff --git a/lisp/frameset.el b/lisp/frameset.el index c1a7ecc16b8..9a474519813 100644 --- a/lisp/frameset.el +++ b/lisp/frameset.el @@ -950,15 +950,10 @@ PARAMETERS is the frame's parameter alist; WINDOW-STATE is its window state. For the meaning of FILTERS and FORCE-ONSCREEN, see `frameset-restore'. Internal use only." (let* ((fullscreen (cdr (assq 'fullscreen parameters))) - (lines (assq 'tool-bar-lines parameters)) (filtered-cfg (frameset-filter-params parameters filters nil)) (display (cdr (assq 'display filtered-cfg))) ;; post-filtering alt-cfg frame) - ;; This works around bug#14795 (or feature#14795, if not a bug :-) - (setq filtered-cfg (assq-delete-all 'tool-bar-lines filtered-cfg)) - (push '(tool-bar-lines . 0) filtered-cfg) - (when fullscreen ;; Currently Emacs has the limitation that it does not record the size ;; and position of a frame before maximizing it, so we cannot save & @@ -1009,8 +1004,7 @@ Internal use only." (not (eq (frame-parameter frame 'visibility) 'icon))) (frameset-move-onscreen frame force-onscreen)) - ;; Let's give the finishing touches (visibility, tool-bar, maximization). - (when lines (push lines alt-cfg)) + ;; Let's give the finishing touches (visibility, maximization). (when alt-cfg (modify-frame-parameters frame alt-cfg)) ;; Now restore window state. (window-state-put window-state (frame-root-window frame) 'safe) From 42ebc34ea8f93efe5b23c0124691207f32055666 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 27 Mar 2014 08:53:13 +0200 Subject: [PATCH 4/6] Fix bug#17097 * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Don't propertize `?' or `!' as symbol constituent when after colon. --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/ruby-mode.el | 1 + test/indent/ruby.rb | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cb256740a03..ff76cadf945 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-03-27 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-syntax-propertize-function): + Don't propertize `?' or `!' as symbol constituent when after + colon. (Bug#17097) + 2014-03-27 Juanma Barranquero * frameset.el (frameset--restore-frame): Remove workaround for bug#14795 diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 2b8f2fa6868..7219221d4e7 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1812,6 +1812,7 @@ It will be properly highlighted even when the call omits parens.") ("[!?]" (0 (unless (save-excursion (or (nth 8 (syntax-ppss (match-beginning 0))) + (eq (char-before) ?:) (let (parse-sexp-lookup-properties) (zerop (skip-syntax-backward "w_"))) (memq (preceding-char) '(?@ ?$)))) diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index 99482433145..fb341ee7ba6 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb @@ -148,6 +148,11 @@ if something == :== ) end +# Bug#17097 +if x == :!= + something +end + # Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html d = 4 + 5 + # no '\' needed 6 + 7 From 8de64bb862ed7221a0c558167f7b6c766603d377 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 27 Mar 2014 10:21:15 +0200 Subject: [PATCH 5/6] * lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight special globals with font-lock-builtin-face. Fixes: debbugs:17057 --- lisp/ChangeLog | 3 +++ lisp/progmodes/ruby-mode.el | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff76cadf945..970402ef86e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2014-03-27 Dmitry Gutov + * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight + special globals with font-lock-builtin-face. (Bug#17057) + * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Don't propertize `?' or `!' as symbol constituent when after colon. (Bug#17097) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 7219221d4e7..6c6cdd3427d 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -2109,13 +2109,28 @@ See `font-lock-syntax-table'.") 1 font-lock-variable-name-face) ;; Keywords that evaluate to certain values. ("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>" - (0 font-lock-variable-name-face)) + (0 font-lock-builtin-face)) ;; Symbols. ("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)" 2 font-lock-constant-face) - ;; Variables. - ("\\$[^a-zA-Z \n]" - 0 font-lock-variable-name-face) + ;; Special globals. + (,(concat "\\$\\(?:[:\"!@;,/\\._><\\$?~=*&`'+0-9]\\|-[0adFiIlpvw]\\|" + (regexp-opt '("LOAD_PATH" "LOADED_FEATURES" "PROGRAM_NAME" + "ERROR_INFO" "ERROR_POSITION" + "FS" "FIELD_SEPARATOR" + "OFS" "OUTPUT_FIELD_SEPARATOR" + "RS" "INPUT_RECORD_SEPARATOR" + "ORS" "OUTPUT_RECORD_SEPARATOR" + "NR" "INPUT_LINE_NUMBER" + "LAST_READ_LINE" "DEFAULT_OUTPUT" "DEFAULT_INPUT" + "PID" "PROCESS_ID" "CHILD_STATUS" + "LAST_MATCH_INFO" "IGNORECASE" + "ARGV" "MATCH" "PREMATCH" "POSTMATCH" + "LAST_PAREN_MATCH" "stdin" "stdout" "stderr" + "DEBUG" "FILENAME" "VERBOSE" "SAFE" "CLASSPATH" + "JRUBY_VERSION" "JRUBY_REVISION" "ENV_JAVA")) + "\\_>\\)") + 0 font-lock-builtin-face) ("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+" 0 font-lock-variable-name-face) ;; Constants. From 0c4e715c98919593413a76a0ab1458b0d10ea287 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Thu, 27 Mar 2014 18:25:17 +0200 Subject: [PATCH 6/6] Fix bug #17115 with displaying on w32 images that have 'box' face. src/w32term.c (x_draw_image_glyph_string): Fix computation of height and width of image background when it is displayed with a 'box' face. --- src/ChangeLog | 6 ++++++ src/w32term.c | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 025ea45b23b..0c24451c459 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-03-27 YAMAMOTO Mitsuharu + + * w32term.c (x_draw_image_glyph_string): Fix computation of height + and width of image background when it is displayed with a 'box' + face. (Bug#17115) + 2014-03-26 Paul Eggert More backward-compatible fix to char-equal core dump (Bug#17011). diff --git a/src/w32term.c b/src/w32term.c index 4c426aca921..2fe73a3eb48 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2085,10 +2085,14 @@ x_draw_image_glyph_string (struct glyph_string *s) int x, y; int box_line_hwidth = eabs (s->face->box_line_width); int box_line_vwidth = max (s->face->box_line_width, 0); - int height; + int height, width; HBITMAP pixmap = 0; - height = s->height - 2 * box_line_vwidth; + height = s->height; + if (s->slice.y == 0) + height -= box_line_vwidth; + if (s->slice.y + s->slice.height >= s->img->height) + height -= box_line_vwidth; /* Fill background with face under the image. Do it only if row is taller than image or if image has a clip mask to reduce @@ -2101,10 +2105,14 @@ x_draw_image_glyph_string (struct glyph_string *s) || s->img->pixmap == 0 || s->width != s->background_width) { + width = s->background_width; x = s->x; if (s->first_glyph->left_box_line_p && s->slice.x == 0) - x += box_line_hwidth; + { + x += box_line_hwidth; + width -= box_line_hwidth; + } y = s->y; if (s->slice.y == 0) @@ -2150,7 +2158,7 @@ x_draw_image_glyph_string (struct glyph_string *s) } else #endif - x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height); + x_draw_glyph_string_bg_rect (s, x, y, width, height); s->background_filled_p = 1; }