]> code.delx.au - gnu-emacs/commitdiff
Merge from origin/emacs-25
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 May 2016 01:07:56 +0000 (18:07 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 May 2016 01:07:56 +0000 (18:07 -0700)
5a952eb Don't mention ~/.emacs.bmk literally in doc strings
c338cf3 * etc/NEWS: Explain why multicolor font display is disabled o...
c30d1b4 Port to Ubuntu 16.04 --enable-gcc-warnings

1  2 
etc/NEWS
src/image.c

diff --combined etc/NEWS
index bc63058de2b73869b01127a35a35b75776d4ce3f,7bedcedae63ab7d684c8b0a8d0813ec41061f678..3c4cf66240a9982cb0ad689075ce5dd7713f3e04
+++ b/etc/NEWS
@@@ -22,447 -22,6 +22,447 @@@ Temporary note
  When you add a new item, use the appropriate mark if you are sure it applies,
  otherwise leave it unmarked.
  
 +\f
 +* Installation Changes in Emacs 25.2
 +
 +** The new option 'configure --enable-gcc-warnings=warn-only' causes
 +GCC to issue warnings without stopping the build.  This behavior is
 +now the default in developer builds.  As before, use
 +'--disable-gcc-warnings' to suppress GCC's warnings, and
 +'--enable-gcc-warnings' to stop the build if GCC issues warnings.
 +
 ++++
 +** The Emacs server now has socket-launching support.  This allows
 +socket based activation, where an external process like systemd can
 +invoke the Emacs server process upon a socket connection event and
 +hand the socket over to Emacs.  Emacs uses this socket to service
 +emacsclient commands.  This new functionality can be disabled with the
 +configure option '--disable-libsystemd'.
 +
 +** New configure option '--disable-build-details' attempts to build an
 +Emacs that is more likely to be reproducible; that is, if you build
 +and install Emacs twice, the second Emacs is a copy of the first.
 +Deterministic builds omit the build date from the output of the
 +emacs-version and erc-cmd-SV functions, and the leave the following
 +variables nil: emacs-build-system, emacs-build-time,
 +erc-emacs-build-time.
 +
 +** Emacs no longer works on IRIX.  We expect that Emacs users are not
 +affected by this, as SGI stopped supporting IRIX in December 2013.
 +
 +\f
 +* Startup Changes in Emacs 25.2
 +
 +\f
 +* Changes in Emacs 25.2
 +
 +---
 +** `find-library-name' will now fall back on looking at `load-history'
 +to try to locate libraries that have been loaded with an explicit path
 +outside `load-path'.
 +
 ++++
 +** Faces in `minibuffer-prompt-properties' no longer overwrite properties
 +in the text in functions like `read-from-minibuffer', but instead are
 +added to the end of the face list.  This allows users to say things
 +like `(read-from-minibuffer (propertize "Enter something: " 'face 'bold))'.
 +
 ++++
 +** The new variable `extended-command-suggest-shorter' has been added
 +to control whether to suggest shorter `M-x' commands or not.
 +
 +---
 +** icomplete now respects `completion-ignored-extensions'.
 +
 ++++
 +** Non-breaking hypens are now displayed with the `nobreak-hyphen'
 +face instead of the `escape-glyph' face.
 +
 +---
 +** `C-x h' (`mark-whole-buffer') will now avoid marking the prompt
 +part of minibuffers.
 +
 +---
 +** `find-library' now takes a prefix argument to pop to a different
 +window.
 +
 +** `find-library', `help-function-def' and `help-variable-def' now run
 +`find-function-after-hook'.
 +
 +---
 +** 'process-attributes' on Darwin systems now returns more information.
 +
 ++++
 +** Several accessors for the value returned by 'file-attributes'
 +have been added.  They are: 'file-attribute-type',
 +'file-attribute-link-number', 'file-attribute-user-id',
 +'file-attribute-group-id', 'file-attribute-access-time',
 +'file-attribute-modification-time',
 +'file-attribute-status-change-time', 'file-attribute-size',
 +'file-attribute-modes', 'file-attribute-inode-number', and
 +'file-attribute-device-number'.
 +
 ++++
 +** The new function 'buffer-hash' computes compute a fast, non-consing
 +hash of a buffer's contents.
 +
 +---
 +** 'fill-paragraph' no longer marks the buffer as changed unless it
 +actually changed something.
 +
 +---
 +** The locale language name 'ca' is now mapped to the language
 +environment 'Catalan', which has been added.
 +
 +---
 +** 'align-regexp' has a separate history for its interactive argument.
 +'align-regexp' no longer shares its history with all other
 +history-less functions that use 'read-string'.
 +
 ++++
 +** The networking code has been reworked so that it's more
 +asynchronous than it was (when specifying :nowait t in
 +'make-network-process').  How asynchronous it is varies based on the
 +capabilities of the system, but on a typical GNU/Linux system the DNS
 +resolution, the connection, and (for TLS streams) the TLS negotiation
 +are all done without blocking the main Emacs thread.  To get
 +asynchronous TLS, the TLS boot parameters have to be passed in (see
 +the manual for details).
 +
 +Certain process oriented functions (like 'process-datagram-address')
 +will block until socket setup has been performed.  The recommended way
 +to deal with asynchronous sockets is to avoid interacting with them
 +until they have changed status to "run".  This is most easily done
 +from a process sentinel.
 +
 +** 'make-network-process' and 'open-network-stream' sometimes allowed
 +:service to be an integer string (e.g., :service "993") and sometimes
 +required an integer (e.g., :service 993).  This difference has been
 +eliminated, and integer strings work everywhere.
 +
 +** It is possible to disable attempted recovery on fatal signals.
 +
 +Two new variables support disabling attempts to recover from stack
 +overflow and to avoid automatic auto-save when Emacs is delivered a
 +fatal signal.  'attempt-stack-overflow-recovery', if set to 'nil',
 +will disable attempts to recover from C stack overflows; Emacs will
 +then crash as with any other fatal signal.
 +'attempt-orderly-shutdown-on-fatal-signal', if set to 'nil', will
 +disable attempts to auto-save the session and shut down in an orderly
 +fashion when Emacs receives a fatal signal; instead, Emacs will
 +terminate immediately.  Both variables are non-'nil' by default.
 +These variables are for users who would like to avoid the small
 +probability of data corruption due to techniques Emacs uses to recover
 +in these situations.
 +
 ++++
 +** A second dir-local file (.dir-locals-2.el) is now accepted.
 +See the variable 'dir-locals-file-2' for more information.
 +
 +---
 +** International domain names (IDNA) are now encoded via the new
 +puny.el library, so that one can visit web sites with non-ASCII URLs.
 +
 ++++
 +** The new 'timer-list' command lists all active timers in a buffer,
 +where you can cancel them with the 'c' command.
 +
 ++++
 +** The new function 'read-multiple-choice' prompts for multiple-choice
 +questions, with a handy way to display help texts.
 +
 +\f
 +* Editing Changes in Emacs 25.2
 +
 ++++
 +** New bindings for 'query-replace-map'.
 +'undo', undo the last replacement; bound to 'u'.
 +'undo-all', undo all replacements; bound to 'U'.
 +
 +\f
 +* Changes in Specialized Modes and Packages in Emacs 25.2
 +
 +** Compilation mode
 +
 +---
 +*** Messages from CMake are now recognized.
 +
 +** Dired
 +
 ++++
 +*** In wdired, when editing files to contain slash characters,
 +the resulting directories are automatically created.  Whether to do
 +this is controlled by the 'wdired-create-parent-directories' variable.
 +
 ++++
 +*** 'W' is now bound to 'browse-url-of-dired-file', and is useful for
 +viewing HTML files and the like.
 +
 +** eww
 +
 ++++
 +*** A new 's' command for switching to another eww buffer via the minibuffer.
 +
 +---
 +*** The 'o' command ('shr-save-contents') has moved to 'O' to avoid collision
 +with the 'o' command from 'image-map'.
 +
 ++++
 +*** A new command 'C' ('eww-toggle-colors') can be used to toggle
 +whether to use the HTML-specified colors or not.  The user can also
 +customize the 'shr-use-colors' variable.
 +
 +---
 +*** Images that are being loaded are now marked with gray
 +"placeholder" images of the size specified by the HTML.  They are then
 +replaced by the real images asynchronously, which will also now
 +respect width/height HTML specs (unless they specify widths/heights
 +bigger than the current window).
 +
 +** Images
 +
 ++++
 +*** Images are automatically scaled before displaying based on the
 +'image-scaling-factor' variable (if Emacs supports scaling the images
 +in question).
 +
 ++++
 +*** Images inserted with 'insert-image' and related functions get a
 +keymap put into the text properties (or overlays) that span the
 +image.  This keymap binds keystrokes for manipulating size and
 +rotation, as well as saving the image to a file.  These commands are
 +also available in 'image-mode'.
 +
 ++++
 +*** A new library for creating and manipulating SVG images has been
 +added.  See the "SVG Images" section in the lispref manual for
 +details.
 +
 ++++
 +*** New setf-able function to access and set image parameters is
 +provided: 'image-property'.
 +
 ++++
 +** The commands that add ChangeLog entries now prefer a VCS root directory
 +for the ChangeLog file, if none already exists.  Customize
 +'change-log-directory-files' to nil for the old behavior.
 +
 +---
 +** Support for non-string values of 'time-stamp-format' has been removed.
 +
 +** Message
 +
 +---
 +*** 'message-use-idna' now defaults to t (because Emacs comes with
 +built-in IDNA support now).
 +
 +---
 +*** The 'message-valid-fqdn-regexp' variable has been removed, since
 +there are now top-level domains added all the time.  Message will no
 +longer warn about sending emails to top-level domains it hasn't heard
 +about.
 +
 +*** 'message-beginning-of-line' (bound to C-a) understands folded headers.
 +In 'visual-line-mode' it will look for the true beginning of a header
 +while in non-'visual-line-mode' it will move the point to the indented
 +header's value.
 +
 +** Tramp
 +
 ++++
 +*** New connection method "sg", which supports editing files under a
 +different group ID.
 +
 ++++
 +*** New connection method "doas" for OpenBSD hosts.
 +
 +---
 +** 'auto-revert-use-notify' is set back to t in 'global-auto-revert-mode'.
 +
 +** CSS mode
 +
 +---
 +*** Support for completing attribute values and bang-rules using the
 +'completion-at-point' command.
 +
 ++++
 +** Emacs now supports character name escape sequences in character and
 +string literals.  The syntax variants \N{character name} and
 +\N{U+code} are supported.
 +
 ++++
 +** Prog mode has some support for multi-mode indentation.
 +This allows better indentation support in modes that support multiple
 +programming languages in the same buffer, like literate programming
 +environments or ANTLR programs with embedded Python code.
 +
 +A major mode can provide indentation context for a sub-mode through
 +the 'prog-indentation-context' variable.  To support this, modes that
 +provide indentation should use 'prog-widen' instead of 'widen' and
 +'prog-first-column' instead of a literal zero.  See the node
 +"Mode-Specific Indent" in the ELisp manual for more details.
 +
 +** ERC
 +
 +*** New variable 'erc-default-port-tls' used to connect to TLS IRC
 +servers.
 +
 +** URL
 +
 ++++
 +*** The new function 'url-cookie-delete-cookie' can be used to
 +programmatically delete all cookies, or cookies from a specific
 +domain.
 +
 ++++
 +*** `url-retrieve-synchronously' now takes an optional timeout parameter.
 +
 +---
 +*** The URL package now support HTTPS over proxies supporting CONNECT.
 +
 ++++
 +*** 'url-user-agent' now defaults to 'default', and the User-Agent
 +string is computed dynamically based on 'url-privacy-level'.
 +
 +** VC and related modes
 +
 +---
 +*** The VC state indicator in the mode line now defaults to more
 +colorful faces to make it more obvious to the user what the state is.
 +See the 'vc-faces' customization group.
 +
 +\f
 +* New Modes and Packages in Emacs 25.2
 +
 +\f
 +* Incompatible Lisp Changes in Emacs 25.2
 +
 ++++
 +** Resizing a frame no longer runs 'window-configuration-change-hook'.
 +Put your function on 'window-size-change-functions' instead.
 +
 +** 'C-up', 'C-down', 'C-left' and 'C-right' are now defined in term
 +mode to send the same escape sequences that xterm does.  This makes
 +things like forward-word in readline work.
 +
 +---
 +** hideshow mode got four key bindings that are analogous to outline
 +mode bindings: 'C-c @ C-a', 'C-c @ C-t', 'C-c @ C-d', and 'C-c @ C-e.'
 +
 +** The grep/rgrep/lgrep functions will now ask about saving files
 +before running.  This is controlled by the 'grep-save-buffers'
 +variable.
 +
 +\f
 +* Lisp Changes in Emacs 25.2
 +
 +** New var syntax-ppss-table to control the syntax-table used in syntax-ppss.
 +
 +** Autoload files can be generated without timestamps,
 +by setting 'autoload-timestamps' to nil.
 +FIXME As an experiment, nil is the current default.
 +If no insurmountable problems before next release, it can stay that way.
 +
 +** 'ert-with-function-mocked' of 'ert-x package allows mocking of functions
 +in unit tests.
 +
 +---
 +** 'gnutls-boot' now takes a parameter :complete-negotiation that says
 +that negotiation should complete even on non-blocking sockets.
 +
 ++++
 +** New functions 'window-pixel-width-before-size-change' and
 +'window-pixel-height-before-size-change' support detecting which
 +window changed size when 'window-size-change-functions' are run.
 +
 ++++
 +** New function 'display-buffer-reuse-mode-window' is an action function
 +suitable for use in 'display-buffer-alist'. For example, to avoid creating
 +a new window when opening man pages when there's already one, use
 +(add-to-list 'display-buffer-alist
 +     '("\\`\\*Man .*\\*\\'" .
 +       (display-buffer-reuse-mode-window
 +        (inhibit-same-window . nil)
 +        (mode . Man-mode))))
 +
 +---
 +** There is now a new variable 'flyspell-sort-corrections-function'
 +that allows changing the way corrections are sorted.
 +
 +---
 +** The new command 'fortune-message' has been added, which displays
 +fortunes in the echo area.
 +
 ++++
 +** New function 'func-arity' returns information about the argument list
 +of an arbitrary function.  This generalizes 'subr-arity' for functions
 +that are not built-in primitives.  We recommend using this new
 +function instead of 'subr-arity'.
 +
 ++++
 +** 'parse-partial-sexp' state has a new element.  Element 10 is
 +non-nil when the last character scanned might be the first character
 +of a two character construct, i.e., a comment delimiter or escaped
 +character.  Its value is the syntax of that last character.
 +
 ++++
 +** 'parse-partial-sexp''s state, element 9, has now been confirmed as
 +permanent and documented, and may be used by Lisp programs.  Its value
 +is a list of currently open parenthesis positions, starting with the
 +outermost parenthesis.
 +
 +---
 +** 'read-color' will now display the color names using the color itself
 +as the background color.
 +
 +** The function 'redirect-debugging-output' now works on platforms
 +other than GNU/Linux.
 +
 ++++
 +** The new function 'string-version-lessp' compares strings by
 +interpreting consecutive runs of numerical characters as numbers, and
 +compares their numerical values.  According to this predicate,
 +"foo2.png" is smaller than "foo12.png".
 +
 ++++
 +** The new function 'char-from-name' converts a Unicode name string
 +to the corresponding character code.
 +
 ++++
 +** New functions 'sxhash-eq' and 'sxhash-eql' return hash codes of a
 +Lisp object suitable for use with 'eq' and 'eql' correspondingly.  If
 +two objects are 'eq' ('eql'), then the result of 'sxhash-eq'
 +('sxhash-eql') on them will be the same.
 +
 ++++
 +** Function 'sxhash' has been renamed to 'sxhash-equal' for
 +consistency with the new functions.  For compatibility, 'sxhash'
 +remains as an alias to 'sxhash-equal'.
 +
 ++++
 +** Time conversion functions that accept a time zone rule argument now
 +allow it to be OFFSET or a list (OFFSET ABBR), where the integer
 +OFFSET is a count of seconds east of Universal Time, and the string
 +ABBR is a time zone abbreviation.  The affected functions are
 +'current-time-string', 'current-time-zone', 'decode-time',
 +'format-time-string', and 'set-time-zone-rule'.
 +
 +\f
 +* Changes in Emacs 25.2 on Non-Free Operating Systems
 +
 +** Intercepting hotkeys on Windows 7 and later now works better.
 +The new keyboard hooking code properly grabs system hotkeys such as
 +Win-* and Alt-TAB, in a way that Emacs can get at them before the
 +system.  This makes the 'w32-register-hot-key' functionality work
 +again on all versions of MS-Windows starting with Windows 7.  On
 +Windows NT and later you can now register any hotkey combination.  (On
 +Windows 9X, the previous limitations, spelled out in the Emacs manual,
 +still apply.)
 +
 +** `convert-standard-filename' no longer mirrors slashes on MS-Windows.
 +Previously, on MS-Windows this function converted slash characters in
 +file names into backslashes.  It no longer does that.
 +
  \f
  * Installation Changes in Emacs 25.1
  
@@@ -2462,6 -2021,12 +2462,12 @@@ non-native NS fullscreen.  The default 
  animation when entering and leaving fullscreen.  For native OSX fullscreen
  this has no effect.
  
+ ** On the OS X Cocoa ("Nextstep") port, multicolor font (such as color
+ emoji) display is disabled.  This feature was accidentally added when
+ Emacs 24.4 included the new Core Text based font backend code that was
+ originally implemented for a non-mainline port.  This will be enabled
+ again once it is also implemented in Emacs on free operating systems.
  ---
  ** The new function 'w32-application-type' returns the type of an
  MS-Windows application given the name of its executable program file.
diff --combined src/image.c
index 2a7c2ccc82df672c47f597a62d98742b8e1c71ac,b07c1815eaca6f4b102322ff835067ddc643cc83..22bbc35fcfbec591fb592f8e30cf44a17ffd6a57
@@@ -2300,7 -2300,7 +2300,7 @@@ x_find_image_fd (Lisp_Object file, int 
             happens, e.g., under Auto Image File Mode.)  'openp'
             didn't open the file, so we should, because the caller
             expects that.  */
 -        fd = emacs_open (SSDATA (file_found), O_RDONLY | O_BINARY, 0);
 +        fd = emacs_open (SSDATA (file_found), O_RDONLY, 0);
        }
      }
    else        /* fd < 0, but not -2 */
@@@ -7979,7 -7979,8 +7979,8 @@@ gif_load (struct frame *f, struct imag
        {
          img->lisp_data
            = Fcons (make_number (ext->Function),
-                    Fcons (make_unibyte_string (ext->Bytes, ext->ByteCount),
+                    Fcons (make_unibyte_string ((char *) ext->Bytes,
+                                                ext->ByteCount),
                            img->lisp_data));
          if (ext->Function == GIF_LOCAL_DESCRIPTOR_EXTENSION
              && ext->ByteCount == 4)
@@@ -8076,25 -8077,15 +8077,25 @@@ compute_image_size (size_t width, size_
  {
    Lisp_Object value;
    int desired_width, desired_height;
 +  double scale = 1;
 +
 +  value = image_spec_value (spec, QCscale, NULL);
 +  if (NUMBERP (value))
 +    scale = extract_float (value);
  
    /* If width and/or height is set in the display spec assume we want
       to scale to those values.  If either h or w is unspecified, the
       unspecified should be calculated from the specified to preserve
       aspect ratio.  */
    value = image_spec_value (spec, QCwidth, NULL);
 -  desired_width = NATNUMP (value) ? min (XFASTINT (value), INT_MAX) : -1;
 +  desired_width = NATNUMP (value) ?
 +    min (XFASTINT (value) * scale, INT_MAX) : -1;
    value = image_spec_value (spec, QCheight, NULL);
 -  desired_height = NATNUMP (value) ? min (XFASTINT (value), INT_MAX) : -1;
 +  desired_height = NATNUMP (value) ?
 +    min (XFASTINT (value) * scale, INT_MAX) : -1;
 +
 +  width = width * scale;
 +  height = height * scale;
  
    if (desired_width == -1)
      {
      /* h known, calculate w.  */
      desired_width = scale_image_size (desired_height, height, width);
  
 +  /* We have no width/height settings, so just apply the scale. */
 +  if (desired_width == -1 && desired_height == -1)
 +    {
 +      desired_width = width;
 +      desired_height = height;
 +    }
 +
    *d_width = desired_width;
    *d_height = desired_height;
  }
@@@ -8566,18 -8550,6 +8567,18 @@@ imagemagick_load_image (struct frame *f
        return 0;
      }
  
 +#ifdef HAVE_MAGICKAUTOORIENTIMAGE
 +  /* If no :rotation is explicitly specified, apply the automatic
 +     rotation from EXIF. */
 +  if (NILP (image_spec_value (img->spec, QCrotation, NULL)))
 +    if (MagickAutoOrientImage (image_wand) == MagickFalse)
 +      {
 +        image_error ("Error applying automatic orientation in image `%s'", img->spec);
 +        DestroyMagickWand (image_wand);
 +        return 0;
 +      }
 +#endif
 +
    if (ino < 0 || ino >= MagickGetNumberImages (image_wand))
      {
        image_error ("Invalid image number `%s' in image `%s'", image, img->spec);
@@@ -9260,8 -9232,8 +9261,8 @@@ svg_load_image (struct frame *f
    eassert (gdk_pixbuf_get_has_alpha (pixbuf));
    eassert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
  
 -#ifdef USE_CAIRO
    {
 +#ifdef USE_CAIRO
      unsigned char *data = (unsigned char *) xmalloc (width*height*4);
      uint32_t bgcolor = get_spec_bg_or_alpha_as_argb (img, f);
  
  
      create_cairo_image_surface (img, data, width, height);
      g_object_unref (pixbuf);
 -  }
  #else
 -  /* Try to create a x pixmap to hold the svg pixmap.  */
 -  XImagePtr ximg;
 -  if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
 -    {
 -      g_object_unref (pixbuf);
 -      return 0;
 -    }
 +    /* Try to create a x pixmap to hold the svg pixmap.  */
 +    XImagePtr ximg;
 +    if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
 +      {
 +      g_object_unref (pixbuf);
 +      return 0;
 +      }
  
 -  init_color_table ();
 +    init_color_table ();
  
 -  /* Handle alpha channel by combining the image with a background
 -     color.  */
 -  XColor background;
 -  Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL);
 -  if (!STRINGP (specified_bg)
 -      || !x_defined_color (f, SSDATA (specified_bg), &background, 0))
 -    x_query_frame_background_color (f, &background);
 -
 -  /* SVG pixmaps specify transparency in the last byte, so right
 -     shift 8 bits to get rid of it, since emacs doesn't support
 -     transparency.  */
 -  background.red   >>= 8;
 -  background.green >>= 8;
 -  background.blue  >>= 8;
 -
 -  /* This loop handles opacity values, since Emacs assumes
 -     non-transparent images.  Each pixel must be "flattened" by
 -     calculating the resulting color, given the transparency of the
 -     pixel, and the image background color.  */
 -  for (int y = 0; y < height; ++y)
 -    {
 -      for (int x = 0; x < width; ++x)
 -      {
 -        int red;
 -        int green;
 -        int blue;
 -        int opacity;
 -
 -        red     = *pixels++;
 -        green   = *pixels++;
 -        blue    = *pixels++;
 -        opacity = *pixels++;
 -
 -        red   = ((red * opacity)
 -                 + (background.red * ((1 << 8) - opacity)));
 -        green = ((green * opacity)
 -                 + (background.green * ((1 << 8) - opacity)));
 -        blue  = ((blue * opacity)
 -                 + (background.blue * ((1 << 8) - opacity)));
 -
 -        XPutPixel (ximg, x, y, lookup_rgb_color (f, red, green, blue));
 -      }
 +    /* Handle alpha channel by combining the image with a background
 +       color.  */
 +    XColor background;
 +    Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL);
 +    if (!STRINGP (specified_bg)
 +      || !x_defined_color (f, SSDATA (specified_bg), &background, 0))
 +      x_query_frame_background_color (f, &background);
 +
 +    /* SVG pixmaps specify transparency in the last byte, so right
 +       shift 8 bits to get rid of it, since emacs doesn't support
 +       transparency.  */
 +    background.red   >>= 8;
 +    background.green >>= 8;
 +    background.blue  >>= 8;
 +
 +    /* This loop handles opacity values, since Emacs assumes
 +       non-transparent images.  Each pixel must be "flattened" by
 +       calculating the resulting color, given the transparency of the
 +       pixel, and the image background color.  */
 +    for (int y = 0; y < height; ++y)
 +      {
 +      for (int x = 0; x < width; ++x)
 +        {
 +          int red     = *pixels++;
 +          int green   = *pixels++;
 +          int blue    = *pixels++;
 +          int opacity = *pixels++;
 +
 +          red   = ((red * opacity)
 +                   + (background.red * ((1 << 8) - opacity)));
 +          green = ((green * opacity)
 +                   + (background.green * ((1 << 8) - opacity)));
 +          blue  = ((blue * opacity)
 +                   + (background.blue * ((1 << 8) - opacity)));
 +
 +          XPutPixel (ximg, x, y, lookup_rgb_color (f, red, green, blue));
 +        }
  
 -      pixels += rowstride - 4 * width;
 -    }
 +      pixels += rowstride - 4 * width;
 +      }
  
  #ifdef COLOR_TABLE_SUPPORT
 -  /* Remember colors allocated for this image.  */
 -  img->colors = colors_in_color_table (&img->ncolors);
 -  free_color_table ();
 +    /* Remember colors allocated for this image.  */
 +    img->colors = colors_in_color_table (&img->ncolors);
 +    free_color_table ();
  #endif /* COLOR_TABLE_SUPPORT */
  
 -  g_object_unref (pixbuf);
 +    g_object_unref (pixbuf);
  
 -  img->width  = width;
 -  img->height = height;
 +    img->width  = width;
 +    img->height = height;
  
 -  /* Maybe fill in the background field while we have ximg handy.
 -     Casting avoids a GCC warning.  */
 -  IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
 +    /* Maybe fill in the background field while we have ximg handy.
 +       Casting avoids a GCC warning.  */
 +    IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
  
 -  /* Put ximg into the image.  */
 -  image_put_x_image (f, img, ximg, 0);
 +    /* Put ximg into the image.  */
 +    image_put_x_image (f, img, ximg, 0);
  #endif /* ! USE_CAIRO */
 +  }
  
    return 1;
  
@@@ -9822,7 -9799,6 +9823,7 @@@ non-numeric, there is no explicit limi
    DEFSYM (QCcrop, ":crop");
    DEFSYM (QCrotation, ":rotation");
    DEFSYM (QCmatrix, ":matrix");
 +  DEFSYM (QCscale, ":scale");
    DEFSYM (QCcolor_adjustment, ":color-adjustment");
    DEFSYM (QCmask, ":mask");