diff options
-rw-r--r-- | doc/misc/eww.texi | 8 | ||||
-rw-r--r-- | lisp/ChangeLog | 36 | ||||
-rw-r--r-- | lisp/emulation/cua-base.el | 6 | ||||
-rw-r--r-- | lisp/emulation/cua-gmrk.el | 2 | ||||
-rw-r--r-- | lisp/files.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-adb.el | 23 | ||||
-rw-r--r-- | lisp/net/tramp-gvfs.el | 234 | ||||
-rw-r--r-- | lisp/net/tramp-sh.el | 35 | ||||
-rw-r--r-- | lisp/net/tramp.el | 7 | ||||
-rw-r--r-- | lisp/progmodes/cc-fonts.el | 4 | ||||
-rw-r--r-- | src/ChangeLog | 23 | ||||
-rw-r--r-- | src/callproc.c | 8 | ||||
-rw-r--r-- | src/dired.c | 5 | ||||
-rw-r--r-- | src/nsterm.m | 14 | ||||
-rw-r--r-- | src/syntax.c | 2 | ||||
-rw-r--r-- | src/xgselect.c | 18 |
16 files changed, 260 insertions, 167 deletions
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index f8f87d37a39..edc2e0fdb3a 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -198,11 +198,11 @@ specific images completely by customizing @code{shr-blocked-images}. @vindex shr-color-visible-distance-min @vindex shr-color-visible-luminance-min @cindex Contrast - EWW (or rather its HTML renderer @code{shr}) use the colors declared -in the HTML page but adjust them if needed to keep a certain minimum -contrast. If that is still to low for you, have a look at the + EWW (or rather its HTML renderer @code{shr}) uses the colors declared +in the HTML page, but adjusts them if needed to keep a certain minimum +contrast. If that is still too low for you, you can customize the variables @code{shr-color-visible-distance-min} and -@code{shr-color-visible-luminance-min}. +@code{shr-color-visible-luminance-min} to get a better contrast. @node History and Acknowledgments @appendix History and Acknowledgments diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a67f9220bbb..ab12e064aaa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,39 @@ +2014-11-08 Michael Albinus <michael.albinus@gmx.de> + + * net/tramp.el (tramp-check-cached-permissions): Include hop in + the constructed Tramp file name. (Bug#18943) + +2014-11-08 Stefan Monnier <monnier@iro.umontreal.ca> + + * emulation/cua-base.el (cua--select-keymaps): Use region-active-p + (bug#18952). + (cua-set-mark, cua--post-command-handler-1): + * emulation/cua-gmrk.el (cua-cancel-global-mark): Same. + +2014-11-08 Michael Albinus <michael.albinus@gmx.de> + + * files.el (file-name-non-special): Wrap the call of + `insert-file-contents' by `unwind-protect', in order to set the + buffer's file name anyway. (Bug#18891) + +2014-11-08 Alan Mackenzie <acm@muc.de> + + Fix wrong bound to c-font-lock-declarators. Fixes bug #18948. + * progmodes/cc-fonts.el (c-font-lock-declarations): Pass + "(point-max)" as bound to c-font-lock-declarators, not "limit", as + the buffer is sometimes narrowed to less than "limit" (e.g., in + the presence of macros). + +2014-11-08 Michael Albinus <michael.albinus@gmx.de> + + * net/tramp.el (tramp-error-with-buffer): Show connection buffer + only when message appeared in minibuffer. (Bug#18891) + + * net/tramp-adb.el (tramp-adb-handle-file-attributes): + * net/tramp-gvfs.el (tramp-gvfs-handle-file-attributes): + * net/tramp-sh.el (tramp-sh-handle-file-attributes): Return nil in + case of errors. + 2014-11-08 Stefan Monnier <monnier@iro.umontreal.ca> * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment): diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index 0b6891d6d6d..2b4d0f6ba90 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el @@ -1015,7 +1015,7 @@ With a double \\[universal-argument] prefix argument, unconditionally set mark." (or (and cua-auto-mark-last-change (cua-pop-to-last-change)) (pop-to-mark-command))) - ((and cua-toggle-set-mark mark-active) + ((and cua-toggle-set-mark (region-active-p)) (cua--deactivate) (message "Mark cleared")) (t @@ -1127,7 +1127,7 @@ If ARG is the atom `-', scroll upward by nearly full screen." (if cua--debug (cond (cua--rectangle (cua--rectangle-assert)) - (mark-active (message "Mark=%d Point=%d" (mark t) (point))))) + ((region-active-p) (message "Mark=%d Point=%d" (mark t) (point))))) (if cua-enable-cursor-indications (cua--update-indications)) @@ -1186,7 +1186,7 @@ If ARG is the atom `-', scroll upward by nearly full screen." (defun cua--select-keymaps () ;; Setup conditions for selecting the proper keymaps in cua--keymap-alist. (setq cua--ena-region-keymap - (and mark-active (not deactivate-mark))) + (and (region-active-p) (not deactivate-mark))) (setq cua--ena-prefix-override-keymap (and cua--ena-region-keymap cua-enable-cua-keys diff --git a/lisp/emulation/cua-gmrk.el b/lisp/emulation/cua-gmrk.el index b77b2105f64..3d6c9d62a26 100644 --- a/lisp/emulation/cua-gmrk.el +++ b/lisp/emulation/cua-gmrk.el @@ -321,7 +321,7 @@ With prefix argument, don't jump to global mark when canceling it." (defun cua-cancel-global-mark () "Cancel the global mark." (interactive) - (if mark-active + (if (region-active-p) (cua-cancel) (if (cua--global-mark-active) (cua--deactivate-global-mark t))) diff --git a/lisp/files.el b/lisp/files.el index be1b6c29d10..c9d1d2da3b8 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6670,7 +6670,7 @@ only these files will be asked to be saved." (`add (concat "/:" (apply operation arguments))) (`insert-file-contents (let ((visit (nth 1 arguments))) - (prog1 + (unwind-protect (apply operation arguments) (when (and visit buffer-file-name) (setq buffer-file-name (concat "/:" buffer-file-name)))))) diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 639f07b2f1d..2401b4af479 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -316,17 +316,18 @@ pass to the OPERATION." (defun tramp-adb-handle-file-attributes (filename &optional id-format) "Like `file-attributes' for Tramp files." (unless id-format (setq id-format 'integer)) - (with-parsed-tramp-file-name filename nil - (with-tramp-file-property - v localname (format "file-attributes-%s" id-format) - (and - (tramp-adb-send-command-and-check - v (format "%s -d -l %s" - (tramp-adb-get-ls-command v) - (tramp-shell-quote-argument localname))) - (with-current-buffer (tramp-get-buffer v) - (tramp-adb-sh-fix-ls-output) - (cdar (tramp-do-parse-file-attributes-with-ls v id-format))))))) + (ignore-errors + (with-parsed-tramp-file-name filename nil + (with-tramp-file-property + v localname (format "file-attributes-%s" id-format) + (and + (tramp-adb-send-command-and-check + v (format "%s -d -l %s" + (tramp-adb-get-ls-command v) + (tramp-shell-quote-argument localname))) + (with-current-buffer (tramp-get-buffer v) + (tramp-adb-sh-fix-ls-output) + (cdar (tramp-do-parse-file-attributes-with-ls v id-format)))))))) (defun tramp-do-parse-file-attributes-with-ls (vec &optional id-format) "Parse `file-attributes' for Tramp files using the ls(1) command." diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 1b4c1694a92..30802273d5c 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -720,124 +720,128 @@ is no information where to trace the message.") (defun tramp-gvfs-handle-file-attributes (filename &optional id-format) "Like `file-attributes' for Tramp files." (unless id-format (setq id-format 'integer)) - ;; Don't modify `last-coding-system-used' by accident. - (let ((last-coding-system-used last-coding-system-used) - dirp res-symlink-target res-numlinks res-uid res-gid res-access - res-mod res-change res-size res-filemodes res-inode res-device) - (with-parsed-tramp-file-name filename nil - (with-tramp-file-property - v localname (format "file-attributes-%s" id-format) - (tramp-message v 5 "file attributes: %s" localname) - (tramp-gvfs-send-command - v "gvfs-info" (tramp-gvfs-url-file-name filename)) - ;; Parse output ... - (with-current-buffer (tramp-get-connection-buffer v) - (goto-char (point-min)) - (when (re-search-forward "attributes:" nil t) - ;; ... directory or symlink - (goto-char (point-min)) - (setq dirp (if (re-search-forward "type:\\s-+directory" nil t) t)) - (goto-char (point-min)) - (setq res-symlink-target - (if (re-search-forward - "standard::symlink-target:\\s-+\\(\\S-+\\)" nil t) - (match-string 1))) - ;; ... number links - (goto-char (point-min)) - (setq res-numlinks - (if (re-search-forward "unix::nlink:\\s-+\\([0-9]+\\)" nil t) - (string-to-number (match-string 1)) 0)) - ;; ... uid and gid + (ignore-errors + ;; Don't modify `last-coding-system-used' by accident. + (let ((last-coding-system-used last-coding-system-used) + dirp res-symlink-target res-numlinks res-uid res-gid res-access + res-mod res-change res-size res-filemodes res-inode res-device) + (with-parsed-tramp-file-name filename nil + (with-tramp-file-property + v localname (format "file-attributes-%s" id-format) + (tramp-message v 5 "file attributes: %s" localname) + (tramp-gvfs-send-command + v "gvfs-info" (tramp-gvfs-url-file-name filename)) + ;; Parse output ... + (with-current-buffer (tramp-get-connection-buffer v) (goto-char (point-min)) - (setq res-uid - (or (if (eq id-format 'integer) + (when (re-search-forward "attributes:" nil t) + ;; ... directory or symlink + (goto-char (point-min)) + (setq dirp (if (re-search-forward "type:\\s-+directory" nil t) t)) + (goto-char (point-min)) + (setq res-symlink-target + (if (re-search-forward + "standard::symlink-target:\\s-+\\(\\S-+\\)" nil t) + (match-string 1))) + ;; ... number links + (goto-char (point-min)) + (setq res-numlinks + (if (re-search-forward + "unix::nlink:\\s-+\\([0-9]+\\)" nil t) + (string-to-number (match-string 1)) 0)) + ;; ... uid and gid + (goto-char (point-min)) + (setq res-uid + (or (if (eq id-format 'integer) + (if (re-search-forward + "unix::uid:\\s-+\\([0-9]+\\)" nil t) + (string-to-number (match-string 1))) (if (re-search-forward - "unix::uid:\\s-+\\([0-9]+\\)" nil t) - (string-to-number (match-string 1))) - (if (re-search-forward - "owner::user:\\s-+\\(\\S-+\\)" nil t) - (match-string 1))) - (tramp-get-local-uid id-format))) - (setq res-gid - (or (if (eq id-format 'integer) + "owner::user:\\s-+\\(\\S-+\\)" nil t) + (match-string 1))) + (tramp-get-local-uid id-format))) + (setq res-gid + (or (if (eq id-format 'integer) + (if (re-search-forward + "unix::gid:\\s-+\\([0-9]+\\)" nil t) + (string-to-number (match-string 1))) (if (re-search-forward - "unix::gid:\\s-+\\([0-9]+\\)" nil t) - (string-to-number (match-string 1))) - (if (re-search-forward - "owner::group:\\s-+\\(\\S-+\\)" nil t) - (match-string 1))) - (tramp-get-local-gid id-format))) - ;; ... last access, modification and change time - (goto-char (point-min)) - (setq res-access - (if (re-search-forward - "time::access:\\s-+\\([0-9]+\\)" nil t) - (seconds-to-time (string-to-number (match-string 1))) - '(0 0))) - (goto-char (point-min)) - (setq res-mod - (if (re-search-forward - "time::modified:\\s-+\\([0-9]+\\)" nil t) - (seconds-to-time (string-to-number (match-string 1))) - '(0 0))) - (goto-char (point-min)) - (setq res-change - (if (re-search-forward - "time::changed:\\s-+\\([0-9]+\\)" nil t) - (seconds-to-time (string-to-number (match-string 1))) - '(0 0))) - ;; ... size - (goto-char (point-min)) - (setq res-size - (if (re-search-forward - "standard::size:\\s-+\\([0-9]+\\)" nil t) - (string-to-number (match-string 1)) 0)) - ;; ... file mode flags - (goto-char (point-min)) - (setq res-filemodes - (if (re-search-forward "unix::mode:\\s-+\\([0-9]+\\)" nil t) - (tramp-file-mode-from-int - (string-to-number (match-string 1))) - (if dirp "drwx------" "-rwx------"))) - ;; ... inode and device - (goto-char (point-min)) - (setq res-inode - (if (re-search-forward "unix::inode:\\s-+\\([0-9]+\\)" nil t) - (string-to-number (match-string 1)) - (tramp-get-inode v))) - (goto-char (point-min)) - (setq res-device - (if (re-search-forward "unix::device:\\s-+\\([0-9]+\\)" nil t) - (string-to-number (match-string 1)) - (tramp-get-device v))) - - ;; Return data gathered. - (list - ;; 0. t for directory, string (name linked to) for - ;; symbolic link, or nil. - (or dirp res-symlink-target) - ;; 1. Number of links to file. - res-numlinks - ;; 2. File uid. - res-uid - ;; 3. File gid. - res-gid - ;; 4. Last access time, as a list of integers. - ;; 5. Last modification time, likewise. - ;; 6. Last status change time, likewise. - res-access res-mod res-change - ;; 7. Size in bytes (-1, if number is out of range). - res-size - ;; 8. File modes. - res-filemodes - ;; 9. t if file's gid would change if file were deleted - ;; and recreated. - nil - ;; 10. Inode number. - res-inode - ;; 11. Device number. - res-device - ))))))) + "owner::group:\\s-+\\(\\S-+\\)" nil t) + (match-string 1))) + (tramp-get-local-gid id-format))) + ;; ... last access, modification and change time + (goto-char (point-min)) + (setq res-access + (if (re-search-forward + "time::access:\\s-+\\([0-9]+\\)" nil t) + (seconds-to-time (string-to-number (match-string 1))) + '(0 0))) + (goto-char (point-min)) + (setq res-mod + (if (re-search-forward + "time::modified:\\s-+\\([0-9]+\\)" nil t) + (seconds-to-time (string-to-number (match-string 1))) + '(0 0))) + (goto-char (point-min)) + (setq res-change + (if (re-search-forward + "time::changed:\\s-+\\([0-9]+\\)" nil t) + (seconds-to-time (string-to-number (match-string 1))) + '(0 0))) + ;; ... size + (goto-char (point-min)) + (setq res-size + (if (re-search-forward + "standard::size:\\s-+\\([0-9]+\\)" nil t) + (string-to-number (match-string 1)) 0)) + ;; ... file mode flags + (goto-char (point-min)) + (setq res-filemodes + (if (re-search-forward "unix::mode:\\s-+\\([0-9]+\\)" nil t) + (tramp-file-mode-from-int + (string-to-number (match-string 1))) + (if dirp "drwx------" "-rwx------"))) + ;; ... inode and device + (goto-char (point-min)) + (setq res-inode + (if (re-search-forward + "unix::inode:\\s-+\\([0-9]+\\)" nil t) + (string-to-number (match-string 1)) + (tramp-get-inode v))) + (goto-char (point-min)) + (setq res-device + (if (re-search-forward + "unix::device:\\s-+\\([0-9]+\\)" nil t) + (string-to-number (match-string 1)) + (tramp-get-device v))) + + ;; Return data gathered. + (list + ;; 0. t for directory, string (name linked to) for + ;; symbolic link, or nil. + (or dirp res-symlink-target) + ;; 1. Number of links to file. + res-numlinks + ;; 2. File uid. + res-uid + ;; 3. File gid. + res-gid + ;; 4. Last access time, as a list of integers. + ;; 5. Last modification time, likewise. + ;; 6. Last status change time, likewise. + res-access res-mod res-change + ;; 7. Size in bytes (-1, if number is out of range). + res-size + ;; 8. File modes. + res-filemodes + ;; 9. t if file's gid would change if file were deleted + ;; and recreated. + nil + ;; 10. Inode number. + res-inode + ;; 11. Device number. + res-device + )))))))) (defun tramp-gvfs-handle-file-directory-p (filename) "Like `file-directory-p' for Tramp files." diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 3103eb0daa2..6e46df254b2 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1103,23 +1103,24 @@ target of the symlink differ." (defun tramp-sh-handle-file-attributes (filename &optional id-format) "Like `file-attributes' for Tramp files." (unless id-format (setq id-format 'integer)) - ;; Don't modify `last-coding-system-used' by accident. - (let ((last-coding-system-used last-coding-system-used)) - (with-parsed-tramp-file-name (expand-file-name filename) nil - (with-tramp-file-property - v localname (format "file-attributes-%s" id-format) - (save-excursion - (tramp-convert-file-attributes - v - (or - (cond - ((tramp-get-remote-stat v) - (tramp-do-file-attributes-with-stat v localname id-format)) - ((tramp-get-remote-perl v) - (tramp-do-file-attributes-with-perl v localname id-format)) - (t nil)) - ;; The scripts could fail, for example with huge file size. - (tramp-do-file-attributes-with-ls v localname id-format)))))))) + (ignore-errors + ;; Don't modify `last-coding-system-used' by accident. + (let ((last-coding-system-used last-coding-system-used)) + (with-parsed-tramp-file-name (expand-file-name filename) nil + (with-tramp-file-property + v localname (format "file-attributes-%s" id-format) + (save-excursion + (tramp-convert-file-attributes + v + (or + (cond + ((tramp-get-remote-stat v) + (tramp-do-file-attributes-with-stat v localname id-format)) + ((tramp-get-remote-perl v) + (tramp-do-file-attributes-with-perl v localname id-format)) + (t nil)) + ;; The scripts could fail, for example with huge file size. + (tramp-do-file-attributes-with-ls v localname id-format))))))))) (defun tramp-do-file-attributes-with-ls (vec localname &optional id-format) "Implement `file-attributes' for Tramp files using the ls(1) command." diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e3fb177b0c5..5889743e28b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1604,7 +1604,9 @@ an input event arrives. The other arguments are passed to `tramp-error'." (when (and buf tramp-message-show-message (not (zerop tramp-verbose)) - (not (tramp-completion-mode-p))) + (not (tramp-completion-mode-p)) + ;; Show only when Emacs has started already. + (current-message)) (let ((enable-recursive-minibuffers t)) ;; `tramp-error' does not show messages. So we must do it ;; ourselves. @@ -3917,7 +3919,8 @@ be granted." (tramp-file-name-method vec) (tramp-file-name-user vec) (tramp-file-name-host vec) - (tramp-file-name-localname vec)) + (tramp-file-name-localname vec) + (tramp-file-name-hop vec)) (intern suffix)))) (remote-uid (tramp-get-connection-property diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 1c389bc3665..8035c1891d7 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1255,6 +1255,8 @@ casts and declarations are fontified. Used on level 2 and higher." c-font-lock-maybe-decl-faces (lambda (match-pos inside-macro) + ;; Note to maintainers: don't use `limit' inside this lambda form; + ;; c-find-decl-spots sometimes narrows to less than `limit'. (setq start-pos (point)) (when ;; The result of the form below is true when we don't recognize a @@ -1487,7 +1489,7 @@ casts and declarations are fontified. Used on level 2 and higher." ;; At a real declaration? (if (memq (c-forward-type t) '(t known found decltype)) (progn - (c-font-lock-declarators limit t is-typedef) + (c-font-lock-declarators (point-max) t is-typedef) nil) ;; False alarm. Return t to go on to the next check. (goto-char start-pos) diff --git a/src/ChangeLog b/src/ChangeLog index f8ed3b36dde..e3f34e27dfc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,26 @@ +2014-11-08 Jan Djärv <jan.h.d@swipnet.se> + + * nsterm.m (run): Only use non-system event loop if OSX version is + exactly 10.9 (Bug#18993). + +2014-11-08 Michael Albinus <michael.albinus@gmx.de> + + * callproc.c (encode_current_directory): Support handling of file + names prepended by "/:". (Bug#18891) + +2014-11-08 Alan Mackenzie <acm@muc.de> + + * syntax.c (back_comment): Fix off-by-one error (bug#18022). + +2014-11-08 Dima Kogan <dima@secretsauce.net> + + * xgselect.c (xg_select): Use g_main_context_acquire (bug#18861). + +2014-11-08 Michael Albinus <michael.albinus@gmx.de> + + * dired.c (Ffile_attributes): Return Qnil, if Fexpand_file_name + raises an error. (Bug#18891) + 2014-11-08 Martin Rudalics <rudalics@gmx.at> * frame.c (adjust_frame_size): Call x_set_window_size only if diff --git a/src/callproc.c b/src/callproc.c index e3dcc7bbcca..24b88551851 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -127,6 +127,14 @@ encode_current_directory (void) dir = expand_and_dir_to_file (dir, Qnil); + if (NILP (Ffile_accessible_directory_p (dir))) + report_file_error ("Setting current directory", + BVAR (current_buffer, directory)); + + /* Remove "/:" from dir. */ + if (! NILP (Fstring_match (build_string ("^/:"), dir, Qnil))) + dir = Fsubstring (dir, make_number (2), Qnil); + if (STRING_MULTIBYTE (dir)) dir = ENCODE_FILE (dir); if (! file_accessible_directory_p (dir)) diff --git a/src/dired.c b/src/dired.c index ba6a61a2f5b..8afba247e61 100644 --- a/src/dired.c +++ b/src/dired.c @@ -909,7 +909,10 @@ so last access time will always be midnight of that day. */) Lisp_Object encoded; Lisp_Object handler; - filename = Fexpand_file_name (filename, Qnil); + filename = internal_condition_case_2 (Fexpand_file_name, filename, Qnil, + Qt, Fidentity); + if (!STRINGP (filename)) + return Qnil; /* If the file name has special constructs in it, call the corresponding file handler. */ diff --git a/src/nsterm.m b/src/nsterm.m index c8ad50ef339..216678357e7 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4501,15 +4501,15 @@ ns_term_shutdown (int sig) #ifdef NS_IMPL_COCOA - (void)run { -#ifndef NSAppKitVersionNumber10_8 -#define NSAppKitVersionNumber10_8 1187 +#ifndef NSAppKitVersionNumber10_9 +#define NSAppKitVersionNumber10_9 1265 #endif - if (NSAppKitVersionNumber <= NSAppKitVersionNumber10_8) - { - [super run]; - return; - } + if ((int)NSAppKitVersionNumber != NSAppKitVersionNumber10_9) + { + [super run]; + return; + } NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; diff --git a/src/syntax.c b/src/syntax.c index 9f5ef754e2a..dc84ca69fb7 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -825,7 +825,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, { from = comment_end; from_byte = comment_end_byte; - UPDATE_SYNTAX_TABLE_FORWARD (comment_end - 1); + UPDATE_SYNTAX_TABLE_FORWARD (comment_end); } /* If comstart_pos is set and we get here (ie. didn't jump to `lossage' or `done'), then we've found the beginning of the non-nested comment. */ diff --git a/src/xgselect.c b/src/xgselect.c index bf889a90e97..4e2d1c8db69 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -55,19 +55,28 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, GPollFD *gfds = gfds_buf; int gfds_size = ARRAYELTS (gfds_buf); int n_gfds, retval = 0, our_fds = 0, max_fds = fds_lim - 1; - int i, nfds, tmo_in_millisec; + bool context_acquired = false; + int i, nfds, tmo_in_millisec = -1; bool need_to_dispatch; USE_SAFE_ALLOCA; context = g_main_context_default (); + context_acquired = g_main_context_acquire (context); + /* FIXME: If we couldn't acquire the context, we just silently proceed + because this function handles more than just glib file descriptors. + Note that, as implemented, this failure is completely silent: there is + no feedback to the caller. */ if (rfds) all_rfds = *rfds; else FD_ZERO (&all_rfds); if (wfds) all_wfds = *wfds; else FD_ZERO (&all_wfds); - n_gfds = g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec, - gfds, gfds_size); + n_gfds = (context_acquired + ? g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec, + gfds, gfds_size) + : -1); + if (gfds_size < n_gfds) { SAFE_NALLOCA (gfds, sizeof *gfds, n_gfds); @@ -152,6 +161,9 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, errno = pselect_errno; } + if (context_acquired) + g_main_context_release (context); + /* To not have to recalculate timeout, return like this. */ if ((our_fds > 0 || (nfds == 0 && tmop == &tmo)) && (retval == 0)) { |