commit cdf5340f51d4346c276102331e3ed29561753b26 (HEAD, refs/remotes/origin/master) Author: Mark Oteiza Date: Thu Dec 15 21:59:15 2016 -0500 New commands image-scroll-left and image-scroll-right * etc/NEWS: Mention them. * lisp/image-mode.el (image-scroll-left, image-scroll-right): New functions. diff --git a/etc/NEWS b/etc/NEWS index fdd901f..e69ba87 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -457,6 +457,12 @@ details. provided: 'image-property'. --- +*** New commands 'image-scroll-left' and 'image-scroll-right' +for 'image-mode' that complement 'image-scroll-up' and +'image-scroll-down': they have the same prefix arg behavior and stop +at image boundaries. + +--- ** The default 'Info-default-directory-list' no longer checks some obsolete directory suffixes (gnu, gnu/lib, gnu/lib/emacs, emacs, lib, lib/emacs) when searching for info directories. diff --git a/lisp/image-mode.el b/lisp/image-mode.el index ce56208..4a7178d 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -273,6 +273,48 @@ When calling from a program, supply as argument a number, nil, or `-'." (max 0 (- win-height next-screen-context-lines))))) (t (image-next-line (- (prefix-numeric-value n)))))) +(defun image-scroll-left (&optional n) + "Scroll image in current window leftward by N character widths. +Stop if the right edge of the image is reached. +If ARG is omitted or nil, scroll leftward by a near full screen. +A near full screen is 2 columns less than a full screen. +Negative ARG means scroll rightward. +If ARG is the atom `-', scroll rightward by nearly full screen. +When calling from a program, supply as argument a number, nil, or `-'." + (interactive "P") + (cond ((null n) + (let* ((edges (window-inside-edges)) + (win-width (- (nth 2 edges) (nth 0 edges)))) + (image-forward-hscroll + (max 0 (- win-width 2))))) + ((eq n '-) + (let* ((edges (window-inside-edges)) + (win-width (- (nth 2 edges) (nth 0 edges)))) + (image-forward-hscroll + (min 0 (- 2 win-width))))) + (t (image-forward-hscroll (prefix-numeric-value n))))) + +(defun image-scroll-right (&optional n) + "Scroll image in current window rightward by N character widths. +Stop if the left edge of the image is reached. +If ARG is omitted or nil, scroll downward by a near full screen. +A near full screen is 2 less than a full screen. +Negative ARG means scroll leftward. +If ARG is the atom `-', scroll leftward by nearly full screen. +When calling from a program, supply as argument a number, nil, or `-'." + (interactive "P") + (cond ((null n) + (let* ((edges (window-inside-edges)) + (win-width (- (nth 2 edges) (nth 0 edges)))) + (image-forward-hscroll + (min 0 (- 2 win-width))))) + ((eq n '-) + (let* ((edges (window-inside-edges)) + (win-width (- (nth 2 edges) (nth 0 edges)))) + (image-forward-hscroll + (max 0 (- win-width 2))))) + (t (image-forward-hscroll (- (prefix-numeric-value n)))))) + (defun image-bol (arg) "Scroll horizontally to the left edge of the image in the current window. With argument ARG not nil or 1, move forward ARG - 1 lines first, @@ -401,6 +443,8 @@ call." (define-key map [remap scroll-down] 'image-scroll-down) (define-key map [remap scroll-up-command] 'image-scroll-up) (define-key map [remap scroll-down-command] 'image-scroll-down) + (define-key map [remap scroll-left] 'image-scroll-left) + (define-key map [remap scroll-right] 'image-scroll-right) (define-key map [remap move-beginning-of-line] 'image-bol) (define-key map [remap move-end-of-line] 'image-eol) (define-key map [remap beginning-of-buffer] 'image-bob) commit f8a47b07ff4604a807193937922f3ba6f8eaf488 Author: Mark Oteiza Date: Thu Dec 15 20:36:24 2016 -0500 More image-dired refactoring * lisp/image-dired.el (image-dired-thumbnail-mode): (image-dired-display-image-mode): Add :group 'image-dired so customize-mode works. (image-dired-display-image): Rearrange. (image-dired-copy-with-exif-file-name): This map is for side effect. (image-dired-dired-edit-comment-and-tags): Just use #'identity. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 5ccc040..2925d0c 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1463,6 +1463,7 @@ You probably want to use this together with special-mode "image-dired-thumbnail" "Browse and manipulate thumbnail images using dired. Use `image-dired-minor-mode' to get a nice setup." + :group 'image-dired (buffer-disable-undo) (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)) @@ -1470,6 +1471,7 @@ Use `image-dired-minor-mode' to get a nice setup." special-mode "image-dired-image-display" "Mode for displaying and manipulating original image. Resized or in full-size." + :group 'image-dired (buffer-disable-undo) (image-mode-setup-winprops) (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)) @@ -1741,26 +1743,22 @@ original size." 'image-dired-cmd-create-temp-image-program) (let ((new-file (expand-file-name image-dired-temp-image-file)) (window (image-dired-display-window)) - width height command ret (image-type 'jpeg)) (setq file (expand-file-name file)) (if (not original-size) - (progn - (setq width (image-dired-display-window-width window)) - (setq height (image-dired-display-window-height window)) - (setq command + (let* ((command (format-spec image-dired-cmd-create-temp-image-options (list (cons ?p image-dired-cmd-create-temp-image-program) - (cons ?w width) - (cons ?h height) + (cons ?w (image-dired-display-window-width window)) + (cons ?h (image-dired-display-window-height window)) (cons ?f file) (cons ?t new-file)))) - (setq ret (call-process shell-file-name nil nil nil - shell-command-switch command)) - (if (not (= 0 ret)) - (error "Could not resize image"))) + (ret (call-process shell-file-name nil nil nil + shell-command-switch command))) + (when (not (zerop ret)) + (error "Could not resize image"))) (setq image-type (image-type-from-file-name file)) (copy-file file new-file t)) (with-current-buffer (image-dired-create-display-image-buffer) @@ -1983,7 +1981,7 @@ function. The result is a couple of new files in (interactive) (let (new-name (files (dired-get-marked-files))) - (mapcar + (mapc (lambda (curr-file) (setq new-name (format "%s/%s" @@ -2433,8 +2431,7 @@ the operation by activating the Cancel button.\n\n") :size 60 :format "%v " :value (or (mapconcat - (lambda (tag) - tag) + #'identity (image-dired-list-tags file) ",") ""))) ;; Save information in all widgets so that we can use it when commit 9886239bd29f3a7b95da61f852fecef3cfa32825 Author: Mark Oteiza Date: Thu Dec 15 19:58:33 2016 -0500 * lisp/image-dired.el: Turn on lexical-binding. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 63e3aa9..5ccc040 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1,4 +1,4 @@ -;;; image-dired.el --- use dired to browse and manipulate your images +;;; image-dired.el --- use dired to browse and manipulate your images -*- lexical-binding: t -*- ;; ;; Copyright (C) 2005-2016 Free Software Foundation, Inc. ;; commit 7ec55a189c45b29efdf68d2bc1a8b0d865aa9b6b Author: Mark Oteiza Date: Thu Dec 15 19:55:47 2016 -0500 Teach image-dired to also generate large thumbs * lisp/image-dired.el (image-dired-thumbnail-storage): Add standard-large option. (image-dired-thumb-size): Add condition for standard-large storage. (image-dired-insert-thumbnail): Check for new option. Change thumbnail path conditionally. (image-dired-thumb-size): New function. (image-dired-create-thumb, image-dired-line-up-dynamic): Use it. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 60b7a5d..63e3aa9 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -180,8 +180,9 @@ means that each thumbnail is stored in a subdirectory called stored and generated according to the Thumbnail Managing Standard that allows sharing of thumbnails across different programs." :type '(choice :tag "How to store thumbnail files" - (const :tag "Thumbnail Managing Standard" standard) (const :tag "Use image-dired-dir" use-image-dired-dir) + (const :tag "Thumbnail Managing Standard (normal 128x128)" standard) + (const :tag "Thumbnail Managing Standard (large 256x256)" standard-large) (const :tag "Per-directory" per-directory)) :group 'image-dired) @@ -399,7 +400,10 @@ Used by `image-dired-gallery-generate' to leave out \"hidden\" images." :group 'image-dired) (defcustom image-dired-thumb-size - (if (eq 'standard image-dired-thumbnail-storage) 128 100) + (cond + ((eq 'standard image-dired-thumbnail-storage) 128) + ((eq 'standard-large image-dired-thumbnail-storage) 256) + (t 100)) "Size of thumbnails, in pixels. This is the default size for both `image-dired-thumb-width' and `image-dired-thumb-height'." @@ -569,7 +573,8 @@ Add text properties ORIGINAL-FILE-NAME and ASSOCIATED-DIRED-BUFFER." (setq beg (point)) (image-dired-insert-image file ;; TODO: this should depend on the real file type - (if (eq 'standard image-dired-thumbnail-storage) + (if (memq image-dired-thumbnail-storage + '(standard standard-large)) 'png 'jpeg) image-dired-thumb-relief image-dired-thumb-margin) @@ -591,13 +596,16 @@ MD5-hash of the image file's directory name and add that to make the thumbnail file name unique. For per-directory storage, just add a subdirectory. For standard storage, produce the file name according to the Thumbnail Managing Standard." - (cond ((eq 'standard image-dired-thumbnail-storage) + (cond ((memq image-dired-thumbnail-storage '(standard standard-large)) (let* ((xdg (getenv "XDG_CACHE_HOME")) (dir (if (and xdg (file-name-absolute-p xdg)) - xdg "~/.cache"))) + xdg "~/.cache")) + (thumbdir (cl-case image-dired-thumbnail-storage + (standard "thumbnails/normal") + (standard-large "thumbnails/large")))) (expand-file-name (concat (md5 (concat "file://" (expand-file-name file))) ".png") - (expand-file-name "thumbnails/normal" dir)))) + (expand-file-name thumbdir dir)))) ((eq 'use-image-dired-dir image-dired-thumbnail-storage) (let* ((f (expand-file-name file)) (md5-hash @@ -622,23 +630,29 @@ according to the Thumbnail Managing Standard." (unless (executable-find (symbol-value executable)) (error "Executable %S not found" executable))) +(defun image-dired-thumb-size (dimension) + "Return thumb size depending on `image-dired-thumbnail-storage'. +DIMENSION should be either the symbol 'width or 'height." + (cond + ((eq 'standard image-dired-thumbnail-storage) 128) + ((eq 'standard-large image-dired-thumbnail-storage) 256) + (t (cl-ecase dimension + (width image-dired-thumb-width) + (height image-dired-thumb-height))))) + (defun image-dired-create-thumb (original-file thumbnail-file) "For ORIGINAL-FILE, create thumbnail image named THUMBNAIL-FILE." (image-dired--check-executable-exists 'image-dired-cmd-create-thumbnail-program) - (let* ((width - (int-to-string (or (and (eq image-dired-thumbnail-storage 'standard) 128) - image-dired-thumb-width))) - (height - (int-to-string (or (and (eq image-dired-thumbnail-storage 'standard) 128) - image-dired-thumb-height))) + (let* ((width (int-to-string (image-dired-thumb-size 'width))) + (height (int-to-string (image-dired-thumb-size 'height))) (modif-time (format "%.0f" (float-time (nth 5 (file-attributes original-file))))) (thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png" thumbnail-file)) (command (format-spec - (if (eq 'standard image-dired-thumbnail-storage) + (if (memq image-dired-thumbnail-storage '(standard standard-large)) image-dired-cmd-create-standard-thumbnail-command image-dired-cmd-create-thumbnail-options) (list @@ -1636,8 +1650,7 @@ Calculate how many thumbnails fit." (/ width (+ (* 2 image-dired-thumb-relief) (* 2 image-dired-thumb-margin) - (or (and (eq image-dired-thumbnail-storage 'standard) 128) - image-dired-thumb-width) + (image-dired-thumb-size 'width) char-width)))) (image-dired-line-up))) commit 5942af614133000a42b3b11f963a30c2b987272e Author: Paul Eggert Date: Thu Dec 15 12:18:28 2016 -0800 Merge from gnulib This incorporates: 2016-12-14 xalloc-oversized: check for PTRDIFF_MAX too 2016-12-12 fpending: port to native Windows with MSVC * .gitignore: Do not ignore lib/stdio-impl.h. * lib/fpending.c, lib/xalloc-oversized.h, m4/fpending.m4: Copy from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/stdio-impl.h: New file, copied from gnulib. * nt/gnulib.mk (EXTRA_DIST): Add stdio-impl.h. diff --git a/.gitignore b/.gitignore index 15f9c56..1de15a1 100644 --- a/.gitignore +++ b/.gitignore @@ -71,6 +71,7 @@ lib/limits.h lib/signal.h lib/std*.h !lib/std*.in.h +!lib/stdio-impl.h lib/string.h lib/sys/ lib/time.h diff --git a/lib/fpending.c b/lib/fpending.c index a503b9f..ce93604 100644 --- a/lib/fpending.c +++ b/lib/fpending.c @@ -19,12 +19,42 @@ #include +/* Specification. */ #include "fpending.h" +#include "stdio-impl.h" + /* Return the number of pending (aka buffered, unflushed) bytes on the stream, FP, that is open for writing. */ size_t __fpending (FILE *fp) { - return PENDING_OUTPUT_N_BYTES; + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + return fp->_IO_write_ptr - fp->_IO_write_base; +#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ + return fp->_p - fp->_bf._base; +#elif defined __EMX__ /* emx+gcc */ + return fp->_ptr - fp->_buffer; +#elif defined __minix /* Minix */ + return fp_->_ptr - fp_->_buf; +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel */ + return (fp_->_ptr ? fp_->_ptr - fp_->_base : 0); +#elif defined __UCLIBC__ /* uClibc */ + return (fp->__modeflags & __FLAG_WRITING ? fp->__bufpos - fp->__bufstart : 0); +#elif defined __QNX__ /* QNX */ + return (fp->_Mode & 0x2000 /*_MWRITE*/ ? fp->_Next - fp->_Buf : 0); +#elif defined __MINT__ /* Atari FreeMiNT */ + return fp->__bufp - fp->__buffer; +#elif defined EPLAN9 /* Plan9 */ + return fp->wp - fp->buf; +#elif defined __VMS /* VMS */ + return (*fp)->_ptr - (*fp)->_base; +#else +# error "Please port gnulib fpending.c to your platform!" + return 1; +#endif } diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 56c2109..0399abc 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk @@ -459,7 +459,7 @@ EXTRA_DIST += flexmember.h ## begin gnulib module fpending -EXTRA_DIST += fpending.c fpending.h +EXTRA_DIST += fpending.c fpending.h stdio-impl.h EXTRA_libgnu_a_SOURCES += fpending.c diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h new file mode 100644 index 0000000..766d693 --- /dev/null +++ b/lib/stdio-impl.h @@ -0,0 +1,140 @@ +/* Implementation details of FILE streams. + Copyright (C) 2007-2008, 2010-2016 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Many stdio implementations have the same logic and therefore can share + the same implementation of stdio extension API, except that some fields + have different naming conventions, or their access requires some casts. */ + + +/* BSD stdio derived implementations. */ + +#if defined __NetBSD__ /* NetBSD */ +/* Get __NetBSD_Version__. */ +# include +#endif + +#include /* For detecting Plan9. */ + +#if defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ + +# if defined __DragonFly__ /* DragonFly */ + /* See . */ +# define fp_ ((struct { struct __FILE_public pub; \ + struct { unsigned char *_base; int _size; } _bf; \ + void *cookie; \ + void *_close; \ + void *_read; \ + void *_seek; \ + void *_write; \ + struct { unsigned char *_base; int _size; } _ub; \ + int _ur; \ + unsigned char _ubuf[3]; \ + unsigned char _nbuf[1]; \ + struct { unsigned char *_base; int _size; } _lb; \ + int _blksize; \ + fpos_t _offset; \ + /* More fields, not relevant here. */ \ + } *) fp) + /* See . */ +# define _p pub._p +# define _flags pub._flags +# define _r pub._r +# define _w pub._w +# else +# define fp_ fp +# endif + +# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Android */ + /* See + and */ + struct __sfileext + { + struct __sbuf _ub; /* ungetc buffer */ + /* More fields, not relevant here. */ + }; +# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub +# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin, Android */ +# define fp_ub fp_->_ub +# endif + +# define HASUB(fp) (fp_ub._base != NULL) + +#endif + + +/* SystemV derived implementations. */ + +#ifdef __TANDEM /* NonStop Kernel */ +# ifndef _IOERR +/* These values were determined by the program 'stdioext-flags' at + . */ +# define _IOERR 0x40 +# define _IOREAD 0x80 +# define _IOWRT 0x4 +# define _IORW 0x100 +# endif +#endif + +#if defined _IOERR + +# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ +# define fp_ ((struct { unsigned char *_ptr; \ + unsigned char *_base; \ + unsigned char *_end; \ + long _cnt; \ + int _file; \ + unsigned int _flag; \ + } *) fp) +# else +# define fp_ fp +# endif + +# if defined _SCO_DS /* OpenServer */ +# define _cnt __cnt +# define _ptr __ptr +# define _base __base +# define _flag __flag +# endif + +#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* newer Windows with MSVC */ + +/* does not define the innards of FILE any more. */ +# define WINDOWS_OPAQUE_FILE + +struct _gl_real_FILE +{ + /* Note: Compared to older Windows and to mingw, it has the fields + _base and _cnt swapped. */ + unsigned char *_ptr; + unsigned char *_base; + int _cnt; + int _flag; + int _file; + int _charbuf; + int _bufsiz; +}; +# define fp_ ((struct _gl_real_FILE *) fp) + +/* These values were determined by a program similar to the one at + . */ +# define _IOREAD 0x1 +# define _IOWRT 0x2 +# define _IORW 0x4 +# define _IOEOF 0x8 +# define _IOERR 0x10 + +#endif diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h index 53e6556..503bb37 100644 --- a/lib/xalloc-oversized.h +++ b/lib/xalloc-oversized.h @@ -19,32 +19,36 @@ #define XALLOC_OVERSIZED_H_ #include +#include /* Default for (non-Clang) compilers that lack __has_builtin. */ #ifndef __has_builtin # define __has_builtin(x) 0 #endif -/* True if N * S would overflow in a size calculation. +/* True if N * S would overflow in a size_t calculation, + or would generate a value larger than PTRDIFF_MAX. This expands to a constant expression if N and S are both constants. By gnulib convention, SIZE_MAX represents overflow in size - calculations, so the conservative dividend to use here is - SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. - However, malloc (SIZE_MAX) fails on all known hosts where - sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for - exactly-SIZE_MAX allocations on such hosts; this avoids a test and - branch when S is known to be 1. */ + calculations, so the conservative size_t-based dividend to use here + is SIZE_MAX - 1. */ #define __xalloc_oversized(n, s) \ - ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) + ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n)) +#if PTRDIFF_MAX < SIZE_MAX +typedef ptrdiff_t __xalloc_count_type; +#else +typedef size_t __xalloc_count_type; +#endif -/* Return 1 if an array of N objects, each of size S, cannot exist due - to size arithmetic overflow. S must be positive and N must be - nonnegative. This is a macro, not a function, so that it - works correctly even when SIZE_MAX < N. */ +/* Return 1 if an array of N objects, each of size S, cannot exist + reliably due to size or ptrdiff_t arithmetic overflow. S must be + positive and N must be nonnegative. This is a macro, not a + function, so that it works correctly even when SIZE_MAX < N. */ #if 7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p) -# define xalloc_oversized(n, s) __builtin_mul_overflow_p (n, s, (size_t) 1) +# define xalloc_oversized(n, s) \ + __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) #elif ((5 <= __GNUC__ \ || (__has_builtin (__builtin_mul_overflow) \ && __has_builtin (__builtin_constant_p))) \ @@ -52,7 +56,8 @@ # define xalloc_oversized(n, s) \ (__builtin_constant_p (n) && __builtin_constant_p (s) \ ? __xalloc_oversized (n, s) \ - : ({ size_t __xalloc_size; __builtin_mul_overflow (n, s, &__xalloc_size); })) + : ({ __xalloc_count_type __xalloc_count; \ + __builtin_mul_overflow (n, s, &__xalloc_count); })) /* Other compilers use integer division; this may be slower but is more portable. */ diff --git a/m4/fpending.m4 b/m4/fpending.m4 index a446156..f6776a8 100644 --- a/m4/fpending.m4 +++ b/m4/fpending.m4 @@ -1,4 +1,4 @@ -# serial 21 +# serial 22 # Copyright (C) 2000-2001, 2004-2016 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -11,7 +11,7 @@ dnl and Ulrich Drepper. dnl Find out how to determine the number of pending output bytes on a stream. dnl glibc (2.1.93 and newer) and Solaris provide __fpending. On other systems, -dnl we have to grub around in the FILE struct. +dnl we have to grub around in the (possibly opaque) FILE struct. AC_DEFUN([gl_FUNC_FPENDING], [ @@ -34,66 +34,3 @@ AC_DEFUN([gl_FUNC_FPENDING], AC_CHECK_DECLS([__fpending], [], [], [$fp_headers]) fi ]) - -AC_DEFUN([gl_PREREQ_FPENDING], -[ - AC_CACHE_CHECK( - [how to determine the number of pending output bytes on a stream], - ac_cv_sys_pending_output_n_bytes, - [ - for ac_expr in \ - \ - '# glibc2' \ - 'fp->_IO_write_ptr - fp->_IO_write_base' \ - \ - '# traditional Unix' \ - 'fp->_ptr - fp->_base' \ - \ - '# BSD' \ - 'fp->_p - fp->_bf._base' \ - \ - '# SCO, Unixware' \ - '(fp->__ptr ? fp->__ptr - fp->__base : 0)' \ - \ - '# QNX' \ - '(fp->_Mode & 0x2000 /*_MWRITE*/ ? fp->_Next - fp->_Buf : 0)' \ - \ - '# old glibc?' \ - 'fp->__bufp - fp->__buffer' \ - \ - '# old glibc iostream?' \ - 'fp->_pptr - fp->_pbase' \ - \ - '# emx+gcc' \ - 'fp->_ptr - fp->_buffer' \ - \ - '# Minix' \ - 'fp->_ptr - fp->_buf' \ - \ - '# Plan9' \ - 'fp->wp - fp->buf' \ - \ - '# VMS' \ - '(*fp)->_ptr - (*fp)->_base' \ - \ - '# e.g., DGUX R4.11; the info is not available' \ - 1 \ - ; do - - # Skip each embedded comment. - case "$ac_expr" in '#'*) continue;; esac - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[FILE *fp = stdin; (void) ($ac_expr);]])], - [fp_done=yes] - ) - test "$fp_done" = yes && break - done - - ac_cv_sys_pending_output_n_bytes=$ac_expr - ] - ) - AC_DEFINE_UNQUOTED([PENDING_OUTPUT_N_BYTES], - $ac_cv_sys_pending_output_n_bytes, - [the number of pending output bytes on stream 'fp']) -]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 592543b..171a3ef 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -238,7 +238,6 @@ AC_DEFUN([gl_INIT], gl_FUNC_FPENDING if test $gl_cv_func___fpending = no; then AC_LIBOBJ([fpending]) - gl_PREREQ_FPENDING fi gl_FUNC_FSTATAT if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then @@ -956,6 +955,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/stdalign.in.h lib/stddef.in.h lib/stdint.in.h + lib/stdio-impl.h lib/stdio.in.h lib/stdlib.in.h lib/stpcpy.c diff --git a/nt/gnulib.mk b/nt/gnulib.mk index 65b206e..6d9fbcf 100644 --- a/nt/gnulib.mk +++ b/nt/gnulib.mk @@ -345,7 +345,7 @@ EXTRA_DIST += filevercmp.h ## begin gnulib module fpending -EXTRA_DIST += fpending.c fpending.h +EXTRA_DIST += fpending.c fpending.h stdio-impl.h EXTRA_libgnu_a_SOURCES += fpending.c commit b80485f6810041a12c84953c59bb6cd956d358c6 Author: Paul Eggert Date: Thu Dec 15 12:06:01 2016 -0800 * emacs-document.svg: Append newline. diff --git a/etc/images/icons/hicolor/scalable/mimetypes/emacs-document.svg b/etc/images/icons/hicolor/scalable/mimetypes/emacs-document.svg index fde79a2..2f5fde0 100644 --- a/etc/images/icons/hicolor/scalable/mimetypes/emacs-document.svg +++ b/etc/images/icons/hicolor/scalable/mimetypes/emacs-document.svg @@ -244,4 +244,4 @@ d="M 343.70805,92.437911 L 340.45142,163.9826 L 407.92401,146.89664 L 343.70805,92.437911 z" /> \ No newline at end of file + d="M 345.72328,141.21214 C 369.54719,142.1578 408.63612,148.57658 423.38894,158.82173 C 429.63156,163.15694 437.02426,166.82736 436.86644,192.2301 C 436.05863,170.15935 433.76569,159.25553 422.20901,147.67024 C 365.34657,90.667114 353.06631,78.680195 332.88312,59.270019 C 316.59252,41.730605 308.6525,39.564301 299.86845,39.1 C 326.8119,41.20075 339.80786,67.674693 345.72328,141.21214 z" /> commit b22cb9690622a5dab0a08c9e5599c53900296097 Author: Mark Oteiza Date: Thu Dec 15 14:40:32 2016 -0500 Don't abuse princ and spam messages * lisp/image-dired.el (image-dired-format-properties-string): Nix princ. (image-dired-display-thumb-properties): (image-dired-dired-display-properties): Nix princ. Bind message-log-max to nil. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 5239b3c..60b7a5d 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1189,14 +1189,14 @@ image." (defun image-dired-format-properties-string (buf file props comment) "Format display properties. BUF is the associated dired buffer, FILE is the original image file -name, PROPS is a list of tags and COMMENT is the image file's +name, PROPS is a stringified list of tags and COMMENT is the image file's comment." (format-spec image-dired-display-properties-format (list (cons ?b (or buf "")) (cons ?f file) - (cons ?t (or (princ props) "")) + (cons ?t (or props "")) (cons ?c (or comment ""))))) (defun image-dired-display-thumb-properties () @@ -1204,11 +1204,9 @@ comment." (if (not (eobp)) (let ((file-name (file-name-nondirectory (image-dired-original-file-name))) (dired-buf (buffer-name (image-dired-associated-dired-buffer))) - (props (mapconcat - 'princ - (get-text-property (point) 'tags) - ", ")) - (comment (get-text-property (point) 'comment))) + (props (mapconcat #'identity (get-text-property (point) 'tags) ", ")) + (comment (get-text-property (point) 'comment)) + (message-log-max nil)) (if file-name (message "%s" (image-dired-format-properties-string @@ -2164,11 +2162,9 @@ non-nil." (let* ((file (dired-get-filename)) (file-name (file-name-nondirectory file)) (dired-buf (buffer-name (current-buffer))) - (props (mapconcat - 'princ - (image-dired-list-tags file) - ", ")) - (comment (image-dired-get-comment file))) + (props (mapconcat #'identity (image-dired-list-tags file) ", ")) + (comment (image-dired-get-comment file)) + (message-log-max nil)) (if file-name (message "%s" (image-dired-format-properties-string commit 214acb1e6b9d7e20e626963526d593371865e5b6 Author: Mark Oteiza Date: Thu Dec 15 13:49:38 2016 -0500 Inherit things from special-mode and image-mode * lisp/image-dired.el: Require image-mode library. (image-dired-thumbnail-mode-map): Remove superfluous binding. (image-dired-display-image-mode-map): Remove superfluous binding. Add movement remaps from image-mode-map. (image-dired-thumbnail-mode): Derive from special-mode. (image-dired-display-image-mode): Derive from special-mode. Call image-mode-setup-winprops. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 86e3432..5239b3c 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -151,6 +151,7 @@ (require 'dired) (require 'format-spec) +(require 'image-mode) (require 'widget) (eval-when-compile @@ -1349,7 +1350,6 @@ You probably want to use this together with (define-key map " " 'image-dired-display-next-thumbnail-original) (define-key map (kbd "DEL") 'image-dired-display-previous-thumbnail-original) (define-key map "c" 'image-dired-comment-thumbnail) - (define-key map "q" 'quit-window) ;; Mouse (define-key map [mouse-2] 'image-dired-mouse-display-image) @@ -1396,9 +1396,27 @@ You probably want to use this together with (defvar image-dired-display-image-mode-map (let ((map (make-sparse-keymap))) - (define-key map "q" 'quit-window) + ;; `image-mode-map' has bindings that do not make sense in image-dired + ;; (set-keymap-parent map image-mode-map) (define-key map "f" 'image-dired-display-current-image-full) (define-key map "s" 'image-dired-display-current-image-sized) + (define-key map "g" nil) + + ;; Useful bindings from `image-mode-map' + (define-key map [remap forward-char] 'image-forward-hscroll) + (define-key map [remap backward-char] 'image-backward-hscroll) + (define-key map [remap right-char] 'image-forward-hscroll) + (define-key map [remap left-char] 'image-backward-hscroll) + (define-key map [remap previous-line] 'image-previous-line) + (define-key map [remap next-line] 'image-next-line) + (define-key map [remap scroll-up] 'image-scroll-up) + (define-key map [remap scroll-down] 'image-scroll-down) + (define-key map [remap scroll-up-command] 'image-scroll-up) + (define-key map [remap scroll-down-command] 'image-scroll-down) + (define-key map [remap move-beginning-of-line] 'image-bol) + (define-key map [remap move-end-of-line] 'image-eol) + (define-key map [remap beginning-of-buffer] 'image-bob) + (define-key map [remap end-of-buffer] 'image-eob) (easy-menu-define nil map "Menu for `image-dired-display-image-mode-map'." @@ -1430,17 +1448,18 @@ You probably want to use this together with (error "No original file name at point")))) (define-derived-mode image-dired-thumbnail-mode - fundamental-mode "image-dired-thumbnail" + special-mode "image-dired-thumbnail" "Browse and manipulate thumbnail images using dired. Use `image-dired-minor-mode' to get a nice setup." (buffer-disable-undo) (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)) (define-derived-mode image-dired-display-image-mode - fundamental-mode "image-dired-image-display" + special-mode "image-dired-image-display" "Mode for displaying and manipulating original image. Resized or in full-size." (buffer-disable-undo) + (image-mode-setup-winprops) (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)) (defvar image-dired-minor-mode-map commit d79ff2a4b9b9096866168a569ec45df15e29288c Author: Mark Oteiza Date: Thu Dec 15 13:25:08 2016 -0500 Fix some image-dired customization types * lisp/image-dired.el (image-dired): Add info link to defgroup. (image-dired-dir, image-dired-gallery-dir): Set type to directory. (image-dired-db-file, image-dired-temp-image-file): (image-dired-cmd-create-thumbnail-program): (image-dired-cmd-create-temp-image-program): (image-dired-cmd-rotate-thumbnail-program): (image-dired-cmd-rotate-original-program): (image-dired-temp-rotate-image-file): (image-dired-cmd-write-exif-data-program): (image-dired-cmd-read-exif-data-program): Set type to file. (image-dired-create-thumb, image-dired-line-up-dynamic): Check storage type at runtime, since setting image-dired-thumb-size does not automatically set image-dired-thumb-width and image-dired-thumb-height. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index a23dbfe..86e3432 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -160,11 +160,12 @@ (defgroup image-dired nil "Use dired to browse your images as thumbnails, and more." :prefix "image-dired-" + :link '(info-link "(emacs) Image-Dired") :group 'multimedia) (defcustom image-dired-dir (locate-user-emacs-file "image-dired/") "Directory where thumbnail images are stored." - :type 'string + :type 'directory :group 'image-dired) (defcustom image-dired-thumbnail-storage 'use-image-dired-dir @@ -186,13 +187,13 @@ that allows sharing of thumbnails across different programs." (defcustom image-dired-db-file (expand-file-name ".image-dired_db" image-dired-dir) "Database file where file names and their associated tags are stored." - :type 'string + :type 'file :group 'image-dired) (defcustom image-dired-temp-image-file (expand-file-name ".image-dired_temp" image-dired-dir) "Name of temporary image file used by various commands." - :type 'string + :type 'file :group 'image-dired) (defcustom image-dired-gallery-dir @@ -200,7 +201,7 @@ that allows sharing of thumbnails across different programs." "Directory to store generated gallery html pages. This path needs to be \"shared\" to the public so that it can access the index.html page that image-dired creates." - :type 'string + :type 'directory :group 'image-dired) (defcustom image-dired-gallery-image-root-url @@ -223,7 +224,7 @@ expects to find pictures in this directory." "convert" "Executable used to create thumbnail. Used together with `image-dired-cmd-create-thumbnail-options'." - :type 'string + :type 'file :group 'image-dired) (defcustom image-dired-cmd-create-thumbnail-options @@ -237,11 +238,10 @@ which is replaced by the file name of the thumbnail file." :type 'string :group 'image-dired) -(defcustom image-dired-cmd-create-temp-image-program - "convert" +(defcustom image-dired-cmd-create-temp-image-program "convert" "Executable used to create temporary image. Used together with `image-dired-cmd-create-temp-image-options'." - :type 'string + :type 'file :group 'image-dired) (defcustom image-dired-cmd-create-temp-image-options @@ -311,7 +311,7 @@ with the information required by the Thumbnail Managing Standard." "mogrify" "Executable used to rotate thumbnail. Used together with `image-dired-cmd-rotate-thumbnail-options'." - :type 'string + :type 'file :group 'image-dired) (defcustom image-dired-cmd-rotate-thumbnail-options @@ -329,7 +329,7 @@ of the thumbnail file." "jpegtran" "Executable used to rotate original image. Used together with `image-dired-cmd-rotate-original-options'." - :type 'string + :type 'file :group 'image-dired) (defcustom image-dired-cmd-rotate-original-options @@ -347,7 +347,7 @@ original image file name and %t which is replaced by (defcustom image-dired-temp-rotate-image-file (expand-file-name ".image-dired_rotate_temp" image-dired-dir) "Temporary file for rotate operations." - :type 'string + :type 'file :group 'image-dired) (defcustom image-dired-rotate-original-ask-before-overwrite t @@ -361,7 +361,7 @@ original file with `image-dired-temp-rotate-image-file'." "exiftool" "Program used to write EXIF data to image. Used together with `image-dired-cmd-write-exif-data-options'." - :type 'string + :type 'file :group 'image-dired) (defcustom image-dired-cmd-write-exif-data-options @@ -377,8 +377,8 @@ which is replaced by the tag value." (defcustom image-dired-cmd-read-exif-data-program "exiftool" "Program used to read EXIF data to image. -Used together with `image-dired-cmd-read-exif-data-program-options'." - :type 'string +Used together with `image-dired-cmd-read-exif-data-options'." + :type 'file :group 'image-dired) (defcustom image-dired-cmd-read-exif-data-options @@ -397,7 +397,8 @@ Used by `image-dired-gallery-generate' to leave out \"hidden\" images." :type '(repeat string) :group 'image-dired) -(defcustom image-dired-thumb-size (if (eq 'standard image-dired-thumbnail-storage) 128 100) +(defcustom image-dired-thumb-size + (if (eq 'standard image-dired-thumbnail-storage) 128 100) "Size of thumbnails, in pixels. This is the default size for both `image-dired-thumb-width' and `image-dired-thumb-height'." @@ -538,7 +539,6 @@ Create the thumbnails directory if it does not exist." (defun image-dired-insert-image (file type relief margin) "Insert image FILE of image TYPE, using RELIEF and MARGIN, at point." - (let ((i `(image :type ,type :file ,file :relief ,relief @@ -625,8 +625,12 @@ according to the Thumbnail Managing Standard." "For ORIGINAL-FILE, create thumbnail image named THUMBNAIL-FILE." (image-dired--check-executable-exists 'image-dired-cmd-create-thumbnail-program) - (let* ((width (int-to-string image-dired-thumb-width)) - (height (int-to-string image-dired-thumb-height)) + (let* ((width + (int-to-string (or (and (eq image-dired-thumbnail-storage 'standard) 128) + image-dired-thumb-width))) + (height + (int-to-string (or (and (eq image-dired-thumbnail-storage 'standard) 128) + image-dired-thumb-height))) (modif-time (format "%.0f" (float-time (nth 5 (file-attributes original-file))))) (thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png" @@ -1615,7 +1619,9 @@ Calculate how many thumbnails fit." (/ width (+ (* 2 image-dired-thumb-relief) (* 2 image-dired-thumb-margin) - image-dired-thumb-width char-width)))) + (or (and (eq image-dired-thumbnail-storage 'standard) 128) + image-dired-thumb-width) + char-width)))) (image-dired-line-up))) (defun image-dired-line-up-interactive () commit 4fbda463dca50f630c31a2602bd34849f4b51e51 Author: Eli Zaretskii Date: Thu Dec 15 18:18:59 2016 +0200 Prevent crashes in xg_select due to concurrency * src/xgselect.c (xg_select): Don't call Glib functions that use 'context' if we failed to acquire it. This means some other thread owns the context, in which case both using the context and calling block_input/unblock_input will step on that thread's toes and eventually lead to crashes. (Bug#25172) diff --git a/src/xgselect.c b/src/xgselect.c index 2f23764..a9461a5 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -150,7 +150,7 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, #else need_to_dispatch = true; #endif - if (need_to_dispatch) + if (need_to_dispatch && context_acquired) { int pselect_errno = errno; /* Prevent g_main_dispatch recursion, that would occur without