commit 369d20559d6118d6b6cee2adc265114ad30fa3b3 (HEAD, refs/remotes/origin/master) Author: Glenn Morris Date: Mon Feb 4 19:50:44 2019 -0800 * make-dist: Prefer a temporary manifest file. This prevents the manifest cluttering up the build tree, and possibly getting stale if --no-update is used. diff --git a/make-dist b/make-dist index ef35c87c35..4e18d77a87 100755 --- a/make-dist +++ b/make-dist @@ -381,27 +381,33 @@ else info_files= fi +echo "Creating staging directory: '${tempparent}'" + +mkdir ${tempparent} || exit +tempdir="${tempparent}/${emacsname}" + +manifest=MANIFEST + +[ -f $manifest ] || manifest=${tempparent}/MANIFEST + # If Git is in use update the file MANIFEST, which can substitute for # 'git ls-files' later (e.g., after extraction from a tarball). # Otherwise, rely on the existing MANIFEST, which should be maintained some # other way when adding or deleting a distributed file while not using Git. -if ( [ $update = yes ] || [ ! -f MANIFEST ] ) && [ -r .git ]; then - echo "Updating MANIFEST" +# TODO: maybe this should ignore $update, and always update MANIFEST +# if .git is present. +if ( [ $update = yes ] || [ ! -f $manifest ] ) && [ -r .git ]; then + echo "Updating $manifest" if [ $with_tests = yes ]; then - git ls-files >MANIFEST + git ls-files > $manifest else - git ls-files | grep -v '^test' >MANIFEST + git ls-files | grep -v '^test' >$manifest fi || exit - printf '%s\n' $possibly_non_vc_files $info_files >>MANIFEST || exit - sort -u -o MANIFEST MANIFEST || exit + printf '%s\n' $possibly_non_vc_files $info_files >>$manifest || exit + sort -u -o $manifest $manifest || exit fi - Date: Mon Feb 4 19:42:33 2019 +0200 Avoid segfaults due to image cache being cleared during redisplay * src/xdisp.c (redisplay_internal): Set the inhibit_clear_image_cache flag of a frame while its windows are being redisplayed, and reset the flag after the call top update_frame returns. * src/image.c (clear_image_cache): Do nothing if the frame's inhibit_clear_image_cache flag is set. (Bug#34256) * src/frame.h (struct frame): New flag inhibit_clear_image_cache. diff --git a/src/frame.h b/src/frame.h index ab3efdfa92..b7cbdd9557 100644 --- a/src/frame.h +++ b/src/frame.h @@ -413,6 +413,10 @@ struct frame /* Non-zero if this frame's faces need to be recomputed. */ bool_bf face_change : 1; + /* Non-zero if this frame's image cache cannot be freed because the + frame is in the process of being redisplayed. */ + bool_bf inhibit_clear_image_cache : 1; + /* Bitfield area ends here. */ /* This frame's change stamp, set the last time window change diff --git a/src/image.c b/src/image.c index 57bbf3cdb9..642bf67152 100644 --- a/src/image.c +++ b/src/image.c @@ -1554,7 +1554,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter) { struct image_cache *c = FRAME_IMAGE_CACHE (f); - if (c) + if (c && !f->inhibit_clear_image_cache) { ptrdiff_t i, nfreed = 0; diff --git a/src/xdisp.c b/src/xdisp.c index b5034b513e..0bffaeb60b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14431,7 +14431,17 @@ redisplay_internal (void) FRAME_TERMINAL (f)->condemn_scroll_bars_hook (f); if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f)) - redisplay_windows (FRAME_ROOT_WINDOW (f)); + { + + /* Don't allow freeing images for this frame as long + as the frame's update wasn't completed. This + prevents crashes when some Lisp that runs from + the various hooks or font-lock decides to clear + the frame's image cache, when the images in that + cache are referenced by the desired matrix. */ + f->inhibit_clear_image_cache = true; + redisplay_windows (FRAME_ROOT_WINDOW (f)); + } /* Remember that the invisible frames need to be redisplayed next time they're visible. */ else if (!REDISPLAY_SOME_P ()) @@ -14512,6 +14522,7 @@ redisplay_internal (void) pending |= update_frame (f, false, false); f->cursor_type_changed = false; f->updated_p = true; + f->inhibit_clear_image_cache = false; } } } @@ -14539,6 +14550,7 @@ redisplay_internal (void) } else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) { + sf->inhibit_clear_image_cache = true; displayed_buffer = XBUFFER (XWINDOW (selected_window)->contents); /* Use list_of_error, not Qerror, so that we catch only errors and don't run the debugger. */ @@ -14594,6 +14606,7 @@ redisplay_internal (void) XWINDOW (selected_window)->must_be_updated_p = true; pending = update_frame (sf, false, false); sf->cursor_type_changed = false; + sf->inhibit_clear_image_cache = false; } /* We may have called echo_area_display at the top of this commit f33a5dc9475ae43bb2477e648befd6a893d216f1 Author: Robert Pluim Date: Sun Jan 27 16:13:46 2019 +0100 Don't map imaps to 993 anymore except on old Windows versions 'open-network-stream' will do the imaps service lookup itself, and using 993 forced the user to use the numeric value in .authinfo for certificate lookups. * lisp/gnus/nnimap.el (nnimap-map-port): Only do mapping for Windows XP or earlier. * etc/NEWS: Describe imaps mapping change. diff --git a/etc/NEWS b/etc/NEWS index a9c009e9d2..72a6b385a8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -590,6 +590,12 @@ Of course it will still find it if you have it in ~/.ecompleterc ** Gnus +--- +*** Gnus now maps imaps to 993 only on old MS-Windows versions. +The nnimap backend used to do this unconditionally to work around +problems on old versions of MS-Windows. This is now done only for +Windows XP and older. + +++ *** The nnimap backend now has support for IMAP namespaces. This feature can be enabled by setting the new 'nnimap-use-namespaces' diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 75b5af8aab..9646bb51d0 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -413,8 +413,11 @@ textual parts.") nil stream))) +;; This is only needed for Windows XP or earlier (defun nnimap-map-port (port) - (if (equal port "imaps") + (if (and (eq system-type 'windows-nt) + (<= (car (x-server-version)) 5) + (equal port "imaps")) "993" port)) commit f37000aeb2b987c0fb14b6770fef69eaf274167a Author: Eli Zaretskii Date: Mon Feb 4 18:05:59 2019 +0200 Support (locale-info 'paper) on MS-Windows * src/w32proc.c (LOCALE_IPAPERSIZE): Define if undefined. (nl_langinfo): Support _NL_PAPER_WIDTH and _NL_PAPER_HEIGHT like glibc does. * src/fns.c (Flocale_info): Update the doc string. * nt/inc/langinfo.h: Add _NL_PAPER_WIDTH and _NL_PAPER_HEIGHT to the enumeration. (_NL_PAPER_WIDTH, _NL_PAPER_HEIGHT): Define namesake macros. * nt/mingw-cfg.site (emacs_cv_langinfo__nl_paper_width): Set to 'yes'. * doc/lispref/nonascii.texi (Locales): Update the documentation of 'locale-info' for the argument of 'paper'. * etc/NEWS: Update the locale-info entry. diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index 56d96cff32..ae9a8ab632 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi @@ -2115,9 +2115,9 @@ Return a 12-element vector of month names (locale items @code{MON_1} through @code{MON_12}). @item paper -Return a list @code{(@var{width} @var{height})} for the default paper -size measured in millimeters (locale items @code{PAPER_WIDTH} and -@code{PAPER_HEIGHT}). +Return a list @w{@code{(@var{width} @var{height})}} of 2 integers, for +the default paper size measured in millimeters (locale items +@code{_NL_PAPER_WIDTH} and @code{_NL_PAPER_HEIGHT}). @end table If the system can't provide the requested information, or if diff --git a/etc/NEWS b/etc/NEWS index bbfc3285ee..a9c009e9d2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1533,12 +1533,14 @@ 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.) -+++ -** (locale-info 'paper) now returns the paper size on GNUish hosts. - The new function 'image-scaling-p' can be used to test whether any given frame supports resizing. ++++ +** (locale-info 'paper) now returns the paper size on systems that support it. +This is currently supported on GNUish hosts and on modern versions of +MS-Windows. + * Changes in Emacs 27.1 on Non-Free Operating Systems diff --git a/nt/inc/langinfo.h b/nt/inc/langinfo.h index fc69068969..6c4959ecb5 100644 --- a/nt/inc/langinfo.h +++ b/nt/inc/langinfo.h @@ -27,6 +27,7 @@ enum { DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7, MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7, MON_8, MON_9, MON_10, MON_11, MON_12, + _NL_PAPER_WIDTH, _NL_PAPER_HEIGHT, /* Number of enumerated values. */ _NL_NUM @@ -55,6 +56,9 @@ enum { #define MON_11 MON_11 #define MON_12 MON_12 +#define _NL_PAPER_WIDTH _NL_PAPER_WIDTH +#define _NL_PAPER_HEIGHT _NL_PAPER_HEIGHT + extern char *nl_langinfo (nl_item); #endif /* _LANGINFO_H */ diff --git a/nt/mingw-cfg.site b/nt/mingw-cfg.site index d9a824008c..4df2049492 100644 --- a/nt/mingw-cfg.site +++ b/nt/mingw-cfg.site @@ -109,6 +109,7 @@ gl_cv_func_pthread_sigmask_return_works=yes gl_cv_func_pthread_sigmask_unblock_works="not relevant" # Implemented in w32proc.c emacs_cv_langinfo_codeset=yes +emacs_cv_langinfo__nl_paper_width=yes # Declared in ms-w32.h ac_cv_have_decl_alarm=yes # Avoid including the gnulib dup2 module diff --git a/src/fns.c b/src/fns.c index a7279b1355..95bafae6c4 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3100,8 +3100,9 @@ ITEM should be one of the following: `months', returning a 12-element vector of month names (locale items MON_n); -`paper', returning a list (WIDTH HEIGHT) for the default paper size, - both measured in millimeters (locale items PAPER_WIDTH, PAPER_HEIGHT). +`paper', returning a list of 2 integers (WIDTH HEIGHT) for the default + paper size, both measured in millimeters (locale items _NL_PAPER_WIDTH, + _NL_PAPER_HEIGHT). If the system can't provide such information through a call to `nl_langinfo', or if ITEM isn't from the list above, return nil. diff --git a/src/w32proc.c b/src/w32proc.c index 05e6c46b33..ab0bf0fff0 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -3248,6 +3248,12 @@ such programs cannot be invoked by Emacs anyway. */) } #ifdef HAVE_LANGINFO_CODESET + +/* If we are compiling for compatibility with older 32-bit Windows + versions, this might not be defined by the Windows headers. */ +#ifndef LOCALE_IPAPERSIZE +# define LOCALE_IPAPERSIZE 0x100A +#endif /* Emulation of nl_langinfo. Used in fns.c:Flocale_info. */ char * nl_langinfo (nl_item item) @@ -3260,7 +3266,8 @@ nl_langinfo (nl_item item) LOCALE_SMONTHNAME1, LOCALE_SMONTHNAME2, LOCALE_SMONTHNAME3, LOCALE_SMONTHNAME4, LOCALE_SMONTHNAME5, LOCALE_SMONTHNAME6, LOCALE_SMONTHNAME7, LOCALE_SMONTHNAME8, LOCALE_SMONTHNAME9, - LOCALE_SMONTHNAME10, LOCALE_SMONTHNAME11, LOCALE_SMONTHNAME12 + LOCALE_SMONTHNAME10, LOCALE_SMONTHNAME11, LOCALE_SMONTHNAME12, + LOCALE_IPAPERSIZE, LOCALE_IPAPERSIZE }; static char *nl_langinfo_buf = NULL; @@ -3269,6 +3276,8 @@ nl_langinfo (nl_item item) if (nl_langinfo_len <= 0) nl_langinfo_buf = xmalloc (nl_langinfo_len = 1); + char *retval = nl_langinfo_buf; + if (item < 0 || item >= _NL_NUM) nl_langinfo_buf[0] = 0; else @@ -3290,6 +3299,8 @@ nl_langinfo (nl_item item) if (nl_langinfo_len <= need_len) nl_langinfo_buf = xrealloc (nl_langinfo_buf, nl_langinfo_len = need_len); + retval = nl_langinfo_buf; + if (!GetLocaleInfo (cloc, w32item[item] | LOCALE_USE_CP_ACP, nl_langinfo_buf, nl_langinfo_len)) nl_langinfo_buf[0] = 0; @@ -3306,9 +3317,32 @@ nl_langinfo (nl_item item) nl_langinfo_buf[1] = 'p'; } } + else if (item == _NL_PAPER_WIDTH || item == _NL_PAPER_HEIGHT) + { + static const int paper_size[][2] = + { + { -1, -1 }, + { 216, 279 }, + { -1, -1 }, + { -1, -1 }, + { -1, -1 }, + { 216, 356 }, + { -1, -1 }, + { -1, -1 }, + { 297, 420 }, + { 210, 297 } + }; + int idx = atoi (nl_langinfo_buf); + if (0 <= idx && idx < ARRAYELTS (paper_size)) + retval = (char *)(intptr_t) (item == _NL_PAPER_WIDTH + ? paper_size[idx][0] + : paper_size[idx][1]); + else + retval = (char *)(intptr_t) -1; + } } } - return nl_langinfo_buf; + return retval; } #endif /* HAVE_LANGINFO_CODESET */ commit d5f629d193ffe88c464379f02dd2adaadc9dfdf0 Author: Federico Tedin Date: Sun Feb 3 13:48:31 2019 -0300 Allow doc-view to open password-protected PDF files (bug#33684) * lisp/doc-view.el (doc-view-ghostscript-options): Removed "-sDEVICE" option. (doc-view-ghostscript-device): New customizable variable, passed as "-sDEVICE" option to GhostScript. (doc-view-pdf-password-protected-ghostscript-p): New function. (doc-view-pdf->png-converter-ghostscript): Can now open password-protected PDF files. (doc-view-pdfdraw-program-subcommand): New function. (doc-view-pdf-password-protected-pdfdraw-p): New function. (doc-view-pdf->png-converter-mupdf): Can now open password-protected PDF files. * etc/NEWS: Mention new doc-view-mode feature. diff --git a/etc/NEWS b/etc/NEWS index 2e3d92f251..bbfc3285ee 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -334,6 +334,7 @@ asked to use :host 'local and :family 'ipv6. ** doc-view-mode *** New commands doc-view-presentation and doc-view-fit-window-to-page +*** Added support for password-protected PDF files ** map.el *** Now also understands plists. diff --git a/lisp/doc-view.el b/lisp/doc-view.el index df8a9fc70f..7ae7c6a96c 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -183,11 +183,16 @@ (defcustom doc-view-ghostscript-options '("-dSAFER" ;; Avoid security problems when rendering files from untrusted ;; sources. - "-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4" + "-dNOPAUSE" "-dTextAlphaBits=4" "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET") "A list of options to give to ghostscript." :type '(repeat string)) +(defcustom doc-view-ghostscript-device "png16m" + "Output device to give to ghostscript." + :type 'string + :version "27.1") + (defcustom doc-view-resolution 100 "Dots per inch resolution used to render the documents. Higher values result in larger images." @@ -950,16 +955,31 @@ Should be invoked when the cached images aren't up-to-date." (list "-o" pdf dvi) callback))) +(defun doc-view-pdf-password-protected-ghostscript-p (pdf) + "Return non-nil if a PDF file is password-protected. +The test is performed using `doc-view-ghostscript-program'." + (with-temp-buffer + (apply #'call-process doc-view-ghostscript-program nil (current-buffer) + nil `(,@doc-view-ghostscript-options + "-sNODISPLAY" + ,pdf)) + (goto-char (point-min)) + (search-forward "This file requires a password for access." nil t))) + (defun doc-view-pdf->png-converter-ghostscript (pdf png page callback) - (doc-view-start-process - "pdf/ps->png" doc-view-ghostscript-program - `(,@doc-view-ghostscript-options - ,(format "-r%d" (round doc-view-resolution)) - ,@(if page `(,(format "-dFirstPage=%d" page))) - ,@(if page `(,(format "-dLastPage=%d" page))) - ,(concat "-sOutputFile=" png) - ,pdf) - callback)) + (let ((pdf-passwd (if (doc-view-pdf-password-protected-ghostscript-p pdf) + (read-passwd "Enter password for PDF file: ")))) + (doc-view-start-process + "pdf/ps->png" doc-view-ghostscript-program + `(,@doc-view-ghostscript-options + ,(concat "-sDEVICE=" doc-view-ghostscript-device) + ,(format "-r%d" (round doc-view-resolution)) + ,@(if page `(,(format "-dFirstPage=%d" page))) + ,@(if page `(,(format "-dLastPage=%d" page))) + ,@(if pdf-passwd `(,(format "-sPDFPassword=%s" pdf-passwd))) + ,(concat "-sOutputFile=" png) + ,pdf) + callback))) (defalias 'doc-view-ps->png-converter-ghostscript 'doc-view-pdf->png-converter-ghostscript) @@ -980,17 +1000,36 @@ If PAGE is nil, convert the whole document." ,tiff) callback)) +(defun doc-view-pdfdraw-program-subcommand () + "Return the mutool subcommand replacing mudraw. +Recent MuPDF distributions replaced 'mudraw' with 'mutool draw'." + (when (string-match "mutool[^/\\]*$" doc-view-pdfdraw-program) + '("draw"))) + +(defun doc-view-pdf-password-protected-pdfdraw-p (pdf) + "Return non-nil if a PDF file is password-protected. +The test is performed using `doc-view-pdfdraw-program'." + (with-temp-buffer + (apply #'call-process doc-view-pdfdraw-program nil (current-buffer) nil + `(,@(doc-view-pdfdraw-program-subcommand) + ,(concat "-o" null-device) + ;; In case PDF isn't password-protected, "draw" only one page. + ,pdf "1")) + (goto-char (point-min)) + (search-forward "error: cannot authenticate password" nil t))) + (defun doc-view-pdf->png-converter-mupdf (pdf png page callback) - (doc-view-start-process - "pdf->png" doc-view-pdfdraw-program - ;; FIXME: Ugly hack: recent mupdf distribution replaced "mudraw" with - ;; "mutool draw". - `(,@(if (string-match "mutool[^/\\]*$" doc-view-pdfdraw-program) '("draw")) - ,(concat "-o" png) - ,(format "-r%d" (round doc-view-resolution)) - ,pdf - ,@(if page `(,(format "%d" page)))) - callback)) + (let ((pdf-passwd (if (doc-view-pdf-password-protected-pdfdraw-p pdf) + (read-passwd "Enter password for PDF file: ")))) + (doc-view-start-process + "pdf->png" doc-view-pdfdraw-program + `(,@(doc-view-pdfdraw-program-subcommand) + ,(concat "-o" png) + ,(format "-r%d" (round doc-view-resolution)) + ,@(if pdf-passwd `("-p" ,pdf-passwd)) + ,pdf + ,@(if page `(,(format "%d" page)))) + callback))) (defun doc-view-odf->pdf-converter-unoconv (odf callback) "Convert ODF to PDF asynchronously and call CALLBACK when finished. commit d6f430cb88bc4c395c1ce9f405a938699491b517 Author: Michael Albinus Date: Mon Feb 4 16:03:43 2019 +0100 Fix Bug#34196 * lisp/net/tramp.el (tramp-process-actions): Disable `global-auto-revert-mode' temporarily. (Bug#34196) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d000bbe3d6..82d2e5a4d3 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4060,17 +4060,23 @@ performed successfully. Any other value means an error." (save-restriction (with-tramp-progress-reporter proc 3 "Waiting for prompts from remote shell" - (let (exit) - (if timeout - (with-timeout (timeout (setq exit 'timeout)) + ;; `global-auto-revert-mode' could activate remote operations + ;; while we aren't ready. We disable it temporarily. + (let ((garm (bound-and-true-p global-auto-revert-mode)) + exit) + (when garm (global-auto-revert-mode -1)) + (unwind-protect + (if timeout + (with-timeout (timeout (setq exit 'timeout)) + (while (not exit) + (setq exit + (catch 'tramp-action + (tramp-process-one-action proc vec actions))))) (while (not exit) (setq exit (catch 'tramp-action (tramp-process-one-action proc vec actions))))) - (while (not exit) - (setq exit - (catch 'tramp-action - (tramp-process-one-action proc vec actions))))) + (when garm (global-auto-revert-mode))) (with-current-buffer (tramp-get-connection-buffer vec) (widen) (tramp-message vec 6 "\n%s" (buffer-string))) commit 7cdf4004c8b04cf5a7135effddc8d4f05981adf9 Author: Michael Albinus Date: Mon Feb 4 16:02:46 2019 +0100 Improve Tramp host name completion * lisp/net/tramp-rclone.el (tramp-default-host-alist): Add empty host. * lisp/net/tramp.el (tramp-parse-auth-sources): Require :port. diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 9f46adb4da..48adea0689 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -50,16 +50,15 @@ ;;;###tramp-autoload (tramp--with-startup - (add-to-list - 'tramp-methods - `(,tramp-rclone-method - (tramp-mount-args nil) - (tramp-copyto-args nil) - (tramp-moveto-args nil) - (tramp-about-args ("--full"))))) + (add-to-list 'tramp-methods + `(,tramp-rclone-method + (tramp-mount-args nil) + (tramp-copyto-args nil) + (tramp-moveto-args nil) + (tramp-about-args ("--full")))) + + (add-to-list 'tramp-default-host-alist `(,tramp-rclone-method nil "")) -;;;###tramp-autoload -(tramp--with-startup (tramp-set-completion-function tramp-rclone-method '((tramp-rclone-parse-device-names "")))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b1c0669048..d000bbe3d6 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2867,7 +2867,8 @@ for all methods. Resulting data are derived from default settings." (and tramp-completion-use-auth-sources (mapcar (lambda (x) `(,(plist-get x :user) ,(plist-get x :host))) - (auth-source-search :port method :max most-positive-fixnum)))) + (auth-source-search + :port method :require '(:port) :max most-positive-fixnum)))) ;; Generic function. (defun tramp-parse-group (regexp match-level skip-regexp)