1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 06:20:43 -08:00

auto upstream

This commit is contained in:
Joakim Verona 2013-01-12 00:04:04 +01:00
commit c655adbbab
21 changed files with 517 additions and 357 deletions

View file

@ -1,3 +1,7 @@
2013-01-11 Eli Zaretskii <eliz@gnu.org>
* lib/getopt_.h: Regenerate.
2013-01-10 Paul Eggert <eggert@cs.ucla.edu>
Merge from gnulib, incorporating:

View file

@ -1,6 +1,6 @@
/* Declarations for getopt.
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free
Software Foundation, Inc.
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@ -53,7 +53,9 @@
linkers. */
#if defined __GETOPT_PREFIX && !defined __need_getopt
# if !HAVE_GETOPT_H
# define __need_system_stdlib_h
# include <stdlib.h>
# undef __need_system_stdlib_h
# include <stdio.h>
# include <unistd.h>
# endif
@ -128,7 +130,7 @@
/* The definition of _GL_ARG_NONNULL is copied here. */
/* A C macro for declaring that specific arguments must not be NULL.
Copyright (C) 2009-2012 Free Software Foundation, Inc.
Copyright (C) 2009-2013 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

View file

@ -1,3 +1,34 @@
2013-01-11 Michael Albinus <michael.albinus@gmx.de>
* autorevert.el (top): Require 'cl in order to pacify byte compiler.
(auto-revert-notify-rm-watch): Ignore errors.
(auto-revert-notify-add-watch): Ignore errors. Use '(modify) for
inotify, and '(size last-write-time) for w32notify. Set
buffer-local `auto-revert-use-notify' to nil when adding a file
watch fails - this is a fallback to the file modification check.
(auto-revert-notify-event-p, auto-revert-notify-event-descriptor)
(auto-revert-notify-event-action)
(auto-revert-notify-event-file-name): New defuns.
(auto-revert-notify-handler): Use them. Implement first
plausibility checks.
(auto-revert-handler): Handle also `auto-revert-tail-mode'.
2013-01-11 Julien Danjou <julien@danjou.info>
* color.el (color-rgb-to-hsv): Fix conversion computing in case min and
max are almost equal. Also return the correct value for V which is
already between 0 and 1.
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
* emacs-lisp/ert.el (ert-run-test): Use point-max-marker.
2013-01-11 Eli Zaretskii <eliz@gnu.org>
* autorevert.el (auto-revert-notify-rm-watch)
(auto-revert-notify-add-watch): Fix typos in w32notify function
names.
2013-01-10 Michael Albinus <michael.albinus@gmx.de>
* autorevert.el (auto-revert-notify-enabled): Move up.

View file

@ -97,6 +97,7 @@
;; Dependencies:
(eval-when-compile (require 'cl))
(require 'timer)
;; Custom Group:
@ -466,8 +467,10 @@ will use an up-to-date value of `auto-revert-interval'"
(defun auto-revert-notify-rm-watch ()
"Disable file watch for current buffer's associated file."
(when auto-revert-notify-watch-descriptor
(funcall (if (fboundp 'inotify-rm-watch) 'inotify-rm-watch 'w32-rm-watch)
auto-revert-notify-watch-descriptor)
(ignore-errors
(funcall (if (fboundp 'inotify-rm-watch)
'inotify-rm-watch 'w32notify-rm-watch)
auto-revert-notify-watch-descriptor))
(remhash auto-revert-notify-watch-descriptor
auto-revert-notify-watch-descriptor-hash-list))
(setq auto-revert-notify-watch-descriptor nil
@ -478,21 +481,62 @@ will use an up-to-date value of `auto-revert-interval'"
(when (and buffer-file-name auto-revert-use-notify)
(auto-revert-notify-rm-watch)
(let ((func (if (fboundp 'inotify-add-watch)
'inotify-add-watch 'w32-add-watch))
'inotify-add-watch 'w32notify-add-watch))
(aspect (if (fboundp 'inotify-add-watch)
'(close-write) '(last-write-time))))
'(modify) '(size last-write-time))))
(setq auto-revert-notify-watch-descriptor
(funcall func buffer-file-name aspect 'auto-revert-notify-handler))
(puthash auto-revert-notify-watch-descriptor
(current-buffer)
auto-revert-notify-watch-descriptor-hash-list))))
(ignore-errors
(funcall
func buffer-file-name aspect 'auto-revert-notify-handler)))
(if auto-revert-notify-watch-descriptor
(puthash auto-revert-notify-watch-descriptor
(current-buffer)
auto-revert-notify-watch-descriptor-hash-list)
;; Fallback to file checks.
(set (make-local-variable 'auto-revert-use-notify) nil)))))
(defun auto-revert-notify-event-p (event)
"Check that event is a file watch event."
(cond ((featurep 'inotify)
(and (listp event) (= (length event) 4)))
((featurep 'w32notify)
(and (listp event) (= (length event) 3) (stringp (nth 2 event))))))
(defun auto-revert-notify-event-descriptor (event)
"Return watch descriptor of notification event, or nil."
(and (auto-revert-notify-event-p event) (car event)))
(defun auto-revert-notify-event-action (event)
"Return action of notification event, or nil."
(and (auto-revert-notify-event-p event) (nth 1 event)))
(defun auto-revert-notify-event-file-name (event)
"Return file name of notification event, or nil."
(and (auto-revert-notify-event-p event)
(cond ((featurep 'inotify) (nth 3 event))
((featurep 'w32notify) (nth 2 event)))))
(defun auto-revert-notify-handler (event)
"Handle an event returned from file watch."
(when (listp event)
(let ((buffer
(gethash (car event) auto-revert-notify-watch-descriptor-hash-list)))
(when (bufferp buffer)
(when (auto-revert-notify-event-p event)
(let* ((descriptor (auto-revert-notify-event-descriptor event))
(action (auto-revert-notify-event-action event))
(file (auto-revert-notify-event-file-name event))
(buffer (gethash descriptor
auto-revert-notify-watch-descriptor-hash-list)))
(ignore-errors
;; Check, that event is meant for us.
;; TODO: Filter events which stop watching, like `move' or `removed'.
(assert descriptor)
(when (featurep 'inotify) (assert (memq 'modify descriptor)))
(when (featurep 'w32notify) (assert (eq 'modified descriptor)))
(assert (bufferp buffer))
(when (stringp file)
(assert (string-equal
(directory-file-name file)
(directory-file-name (buffer-file-name buffer)))))
;; Mark buffer modified.
(with-current-buffer buffer
(setq auto-revert-notify-modified-p t))))))
@ -513,6 +557,8 @@ This is an internal function used by Auto-Revert Mode."
(let* ((buffer (current-buffer)) size
(revert
(or (and buffer-file-name
(or (not auto-revert-use-notify)
auto-revert-notify-modified-p)
(if auto-revert-tail-mode
;; Tramp caches the file attributes. Setting
;; `remote-file-name-inhibit-cache' forces Tramp
@ -523,12 +569,9 @@ This is an internal function used by Auto-Revert Mode."
(setq size
(nth 7 (file-attributes
buffer-file-name))))))
(if auto-revert-use-notify
;; There are file watches.
auto-revert-notify-modified-p
(and (not (file-remote-p buffer-file-name))
(file-readable-p buffer-file-name)
(not (verify-visited-file-modtime buffer))))))
(and (not (file-remote-p buffer-file-name))
(file-readable-p buffer-file-name)
(not (verify-visited-file-modtime buffer)))))
(and (or auto-revert-mode
global-auto-revert-non-file-buffers)
revert-buffer-function

View file

@ -130,7 +130,7 @@ inclusive."
(max (max r g b))
(min (min r g b)))
(if (< (- max min) 1e-8)
(list 0.0 0.0 0.0)
(list 0.0 0.0 min)
(list
(/ (* 2 float-pi
(cond ((and (= r g) (= g b)) 0)
@ -146,7 +146,7 @@ inclusive."
(+ 240 (* 60 (/ (- r g) (- max min)))))))
360)
(if (= max 0) 0 (- 1 (/ min max)))
(/ max 255.0)))))
max))))
(defun color-rgb-to-hsl (red green blue)
"Convert RGB colors to their HSL representation.

View file

@ -937,7 +937,7 @@ Returns the result and stores it in ERT-TEST's `most-recent-result' slot."
(cl-block error
(let ((begin-marker
(with-current-buffer (get-buffer-create "*Messages*")
(set-marker (make-marker) (point-max)))))
(point-max-marker))))
(unwind-protect
(let ((info (make-ert--test-execution-info
:test ert-test

View file

@ -1,3 +1,8 @@
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
* erc-dcc.el (erc-dcc-send-file): Use point-min-marker.
(erc-dcc-chat-setup): Use point-max-marker.
2013-01-04 Glenn Morris <rgm@gnu.org>
* erc-backend.el (312): Fix typo. (Bug#13235)

View file

@ -897,7 +897,7 @@ other client."
(let* ((buffer (erc-dcc-find-file file))
(size (buffer-size buffer))
(start (with-current-buffer buffer
(set-marker (make-marker) (point-min))))
(point-min-marker)))
(sproc (erc-dcc-server "dcc-send"
'erc-dcc-send-filter
'erc-dcc-send-sentinel))
@ -1166,7 +1166,7 @@ other client."
(setq erc-dcc-from nick)
(setq erc-dcc-entry-data entry)
(setq erc-dcc-unprocessed-output "")
(setq erc-insert-marker (set-marker (make-marker) (point-max)))
(setq erc-insert-marker (point-max-marker))
(setq erc-input-marker (make-marker))
(erc-display-prompt buffer (point-max))
(set-process-buffer proc buffer)

View file

@ -1,3 +1,15 @@
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
* gnus-art.el (gnus-mime-display-security): Use point-min-marker
and point-max-marker.
* gnus-async.el (gnus-async-article-callback): Use point-max-marker.
2013-01-10 Uwe Brauer <oub@mat.ucm.es> (tiny change)
* mml-smime.el (mml-smime-encrypt-to-self): New user option analogous
to mml2015-encrypt-to-self.
(mml-smime-epg-encrypt): Respect mml-smime-encrypt-to-self.
2013-01-09 Daiki Ueno <ueno@gnu.org>
* mml-smime.el (epg-sub-key-fingerprint): Autoload for

View file

@ -8688,9 +8688,7 @@ For example:
gnus-mime-security-button-end-line-format))
(gnus-insert-mime-security-button handle)))
(mm-set-handle-multipart-parameter
handle 'gnus-region
(cons (set-marker (make-marker) (point-min))
(set-marker (make-marker) (point-max))))
handle 'gnus-region (cons (point-min-marker) (point-max-marker)))
(goto-char (point-max))))
(defun gnus-mime-security-run-function (function)

View file

@ -254,7 +254,7 @@ that was fetched."
gnus-async-article-alist
(cons (list (intern (format "%s-%d" group article)
gnus-async-hashtb)
mark (set-marker (make-marker) (point-max))
mark (point-max-marker)
group article)
gnus-async-article-alist))))
(if (not (gnus-buffer-live-p summary))

View file

@ -80,6 +80,12 @@ Whether the passphrase is cached at all is controlled by
:version "24.4"
:type 'boolean)
(defcustom mml-smime-encrypt-to-self nil
"If t, add your own key ID to recipient list when encryption."
:group 'mime-security
:version "24.4"
:type 'boolean)
(defun mml-smime-sign (cont)
(let ((func (nth 1 (assq mml-smime-use mml-smime-function-alist))))
(if func
@ -475,13 +481,17 @@ Content-Disposition: attachment; filename=smime.p7s
(goto-char (point-max))))
(defun mml-smime-epg-encrypt (cont)
(let ((inhibit-redisplay t)
(context (epg-make-context 'CMS))
(config (epg-configuration))
(recipients (message-options-get 'mml-smime-epg-recipients))
cipher signers
(boundary (mml-compute-boundary cont))
recipient-key)
(let* ((inhibit-redisplay t)
(context (epg-make-context 'CMS))
(config (epg-configuration))
(recipients (message-options-get 'mml-smime-epg-recipients))
cipher signers
(sender (message-options-get 'message-sender))
(signer-names (or mml-smime-signers
(if (and mml-smime-sign-with-sender sender)
(list (concat "<" sender ">")))))
(boundary (mml-compute-boundary cont))
recipient-key)
(unless recipients
(setq recipients
(apply #'nconc
@ -494,6 +504,10 @@ Content-Disposition: attachment; filename=smime.p7s
(message-options-set 'message-recipients
(read-string "Recipients: ")))
"[ \f\t\n\r\v,]+"))))
(when mml-smime-encrypt-to-self
(unless signer-names
(error "Neither message sender nor mml-smime-signers are set"))
(setq recipients (nconc recipients signer-names)))
(if (eq mm-encrypt-option 'guided)
(setq recipients
(epa-select-keys context "\

View file

@ -1,3 +1,8 @@
2013-01-11 Eli Zaretskii <eliz@gnu.org>
* inc/unistd.h (O_IGNORE_CTTY): Define, as it is unconditionally
used in term.c. (Bug#13387)
2013-01-09 Juanma Barranquero <lekktu@gmail.com>
* config.nt: Sync with autogen/config.in.

View file

@ -27,6 +27,7 @@ extern int faccessat (int, char const *, int, int);
#define AT_SYMLINK_NOFOLLOW 4096
#define O_NOCTTY 0
#define O_IGNORE_CTTY 0
/* This is normally on stdlib.h, but we don't override that header. */
extern int unsetenv (const char *);

View file

@ -1,3 +1,28 @@
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
Avoid unnecessary byte position calculation for the gap movement.
Since all users of move_gap do CHAR_TO_BYTE for other purposes
anyway, all of them should use move_gap_both instead.
* lisp.h (move_gap): Remove prototype.
* insdel.c (move_gap): Remove.
(move_gap_both): Add eassert.
* editfns.c (Ftranspose_regions): Tweak to use move_gap_both.
* xml.c (parse_region): Likewise.
2013-01-11 Paul Eggert <eggert@cs.ucla.edu>
emacsclient -t should not suspend Emacs server (Bug#13387)
* lisp.h, sysdep.c (block_tty_out_signal, unblock_tty_out_signal):
New functions.
* term.c (init_tty): Use them instead of rolling our own code.
* sysdep.c (tcsetpgrp_without_stopping): Likewise. Here, this
switches from 'signal' to 'pthread_sigmask', which is safer in
multithreaded applications.
* term.c (Fresume_tty): Don't bother dissociating if O_IGNORE_CTTY,
which has already arranged for that.
(dissociate_if_controlling_tty): If setsid fails, fall back on TIOCNOTTY.
This is the main part of the bug fix.
2013-01-10 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> (tiny change)
* gtkutil.c (xg_initialize): Add ifdef HAVE_FREETYPE around

View file

@ -4522,7 +4522,7 @@ Transposing beyond buffer boundaries is an error. */)
(Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers)
{
register ptrdiff_t start1, end1, start2, end2;
ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte;
ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte, end2_byte;
ptrdiff_t gap, len1, len_mid, len2;
unsigned char *start1_addr, *start2_addr, *temp;
@ -4583,20 +4583,22 @@ Transposing beyond buffer boundaries is an error. */)
the gap the minimum distance to get it out of the way, and then
deal with an unbroken array. */
start1_byte = CHAR_TO_BYTE (start1);
end2_byte = CHAR_TO_BYTE (end2);
/* Make sure the gap won't interfere, by moving it out of the text
we will operate on. */
if (start1 < gap && gap < end2)
{
if (gap - start1 < end2 - gap)
move_gap (start1);
move_gap_both (start1, start1_byte);
else
move_gap (end2);
move_gap_both (end2, end2_byte);
}
start1_byte = CHAR_TO_BYTE (start1);
start2_byte = CHAR_TO_BYTE (start2);
len1_byte = CHAR_TO_BYTE (end1) - start1_byte;
len2_byte = CHAR_TO_BYTE (end2) - start2_byte;
len2_byte = end2_byte - start2_byte;
#ifdef BYTE_COMBINING_DEBUG
if (end1 == start2)

View file

@ -84,21 +84,14 @@ check_markers (void)
#endif /* MARKER_DEBUG */
/* Move gap to position CHARPOS.
Note that this can quit! */
void
move_gap (ptrdiff_t charpos)
{
move_gap_both (charpos, CHAR_TO_BYTE (charpos));
}
/* Move gap to byte position BYTEPOS, which is also char position CHARPOS.
Note that this can quit! */
void
move_gap_both (ptrdiff_t charpos, ptrdiff_t bytepos)
{
eassert (charpos == BYTE_TO_CHAR (bytepos)
&& bytepos == CHAR_TO_BYTE (charpos));
if (bytepos < GPT_BYTE)
gap_left (charpos, bytepos, 0);
else if (bytepos > GPT_BYTE)

View file

@ -2780,7 +2780,6 @@ extern void syms_of_image (void);
/* Defined in insdel.c. */
extern Lisp_Object Qinhibit_modification_hooks;
extern void move_gap (ptrdiff_t);
extern void move_gap_both (ptrdiff_t, ptrdiff_t);
extern _Noreturn void buffer_overflow (void);
extern void make_gap (ptrdiff_t);
@ -3467,6 +3466,8 @@ extern void init_sigio (int);
extern void sys_subshell (void);
extern void sys_suspend (void);
extern void discard_tty_input (void);
extern void block_tty_out_signal (void);
extern void unblock_tty_out_signal (void);
extern void init_sys_modes (struct tty_display_info *);
extern void reset_sys_modes (struct tty_display_info *);
extern void init_all_sys_modes (void);

View file

@ -714,6 +714,27 @@ init_foreground_group (void)
inherited_pgroup = getpid () == pgrp ? 0 : pgrp;
}
/* Block and unblock SIGTTOU. */
void
block_tty_out_signal (void)
{
#ifdef SIGTTOU
sigset_t blocked;
sigemptyset (&blocked);
sigaddset (&blocked, SIGTTOU);
pthread_sigmask (SIG_BLOCK, &blocked, 0);
#endif
}
void
unblock_tty_out_signal (void)
{
#ifdef SIGTTOU
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
#endif
}
/* Safely set a controlling terminal FD's process group to PGID.
If we are not in the foreground already, POSIX requires tcsetpgrp
to deliver a SIGTTOU signal, which would stop us. This is an
@ -725,11 +746,10 @@ static void
tcsetpgrp_without_stopping (int fd, pid_t pgid)
{
#ifdef SIGTTOU
signal_handler_t handler;
block_input ();
handler = signal (SIGTTOU, SIG_IGN);
block_tty_out_signal ();
tcsetpgrp (fd, pgid);
signal (SIGTTOU, handler);
unblock_tty_out_signal ();
unblock_input ();
#endif
}

View file

@ -2423,7 +2423,7 @@ frame's terminal). */)
if (fd == -1)
error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno));
if (strcmp (t->display_info.tty->name, DEV_TTY))
if (!O_IGNORE_CTTY && strcmp (t->display_info.tty->name, DEV_TTY) != 0)
dissociate_if_controlling_tty (fd);
t->display_info.tty->output = fdopen (fd, "w+");
@ -2903,13 +2903,23 @@ set_tty_hooks (struct terminal *terminal)
terminal->delete_terminal_hook = &delete_tty;
}
/* Drop the controlling terminal if fd is the same device. */
/* If FD is the controlling terminal, drop it. */
static void
dissociate_if_controlling_tty (int fd)
{
pid_t pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */
if (0 <= pgid)
setsid ();
/* If tcgetpgrp succeeds, fd is the controlling terminal,
so dissociate it by invoking setsid. */
if (0 <= tcgetpgrp (fd) && setsid () < 0)
{
#ifdef TIOCNOTTY
/* setsid failed, presumably because Emacs is already a process
group leader. Fall back on the obsolescent way to dissociate
a controlling tty. */
block_tty_out_signal ();
ioctl (fd, TIOCNOTTY, 0);
unblock_tty_out_signal ();
#endif
}
}
/* Create a termcap display on the tty device with the given name and
@ -3030,14 +3040,9 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
/* On some systems, tgetent tries to access the controlling
terminal. */
{
sigset_t blocked;
sigemptyset (&blocked);
sigaddset (&blocked, SIGTTOU);
pthread_sigmask (SIG_BLOCK, &blocked, 0);
status = tgetent (tty->termcap_term_buffer, terminal_type);
pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
}
block_tty_out_signal ();
status = tgetent (tty->termcap_term_buffer, terminal_type);
unblock_tty_out_signal ();
if (status < 0)
{

View file

@ -180,8 +180,7 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
xmlDoc *doc;
Lisp_Object result = Qnil;
const char *burl = "";
ptrdiff_t bytes;
ptrdiff_t istart, iend;
ptrdiff_t istart, iend, istart_byte, iend_byte;
fn_xmlCheckVersion (LIBXML_VERSION);
@ -189,9 +188,11 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
istart = XINT (start);
iend = XINT (end);
istart_byte = CHAR_TO_BYTE (istart);
iend_byte = CHAR_TO_BYTE (iend);
if (istart < GPT && GPT < iend)
move_gap (iend);
move_gap_both (iend, iend_byte);
if (! NILP (base_url))
{
@ -199,17 +200,15 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
burl = SSDATA (base_url);
}
bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart);
if (htmlp)
doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
bytes, burl, "utf-8",
doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
iend_byte - istart_byte, burl, "utf-8",
HTML_PARSE_RECOVER|HTML_PARSE_NONET|
HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
HTML_PARSE_NOBLANKS);
else
doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
bytes, burl, "utf-8",
doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
iend_byte - istart_byte, burl, "utf-8",
XML_PARSE_NONET|XML_PARSE_NOWARNING|
XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);