Commit 7efb4e0e authored by Paul Eggert's avatar Paul Eggert

Merge from trunk.

parents ff5844ad 4e323265
2011-06-22 Leo Liu <sdl.web@gmail.com>
* minibuffer.el (completing-read-function)
(completing-read-default): Move from minibuf.c
2011-06-22 Richard Stallman <rms@gnu.org>
* mail/sendmail.el (mail-bury): If Rmail is in use, return nicely
to Rmail even if not started by a special Rmail command.
* mail/rmailmm.el (rmail-insert-mime-forwarded-message):
Copy the buffer currently showing just one message.
2011-06-22 Roland Winkler <winkler@gnu.org>
* textmodes/bibtex.el (bibtex-entry-update): Use mapc.
......
2011-06-23 Lars Magne Ingebrigtsen <larsi@gnus.org>
* erc.el (erc-ssl): Made into a synonym for erc-tls, which
provides a superset of the same functionality.
(erc-open-ssl-stream): Removed.
(erc-open-tls-stream): Use `open-network-stream' instead of
`open-tls-stream' directly to be able to use the built-in TLS
support.
2011-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
* erc-pcomplete.el (erc-pcompletions-at-point): Mark the completion
......
......@@ -2164,34 +2164,7 @@ be invoked for the values of the other parameters."
;;;###autoload
(defalias 'erc-select 'erc)
(defun erc-ssl (&rest r)
"Interactively select SSL connection parameters and run ERC.
Arguments are the same as for `erc'."
(interactive (erc-select-read-args))
(let ((erc-server-connect-function 'erc-open-ssl-stream))
(apply 'erc r)))
(defalias 'erc-select-ssl 'erc-ssl)
(declare-function open-ssl-stream "ext:ssl" (name buffer host service))
(defun erc-open-ssl-stream (name buffer host port)
"Open an SSL stream to an IRC server.
The process will be given the name NAME, its target buffer will be
BUFFER. HOST and PORT specify the connection target."
(when (condition-case nil
(require 'ssl)
(error (message "You don't have ssl.el. %s"
"Try using `erc-tls' instead.")
nil))
(let ((proc (open-ssl-stream name buffer host port)))
;; Ugly hack, but it works for now. Problem is it is
;; very hard to detect when ssl is established, because s_client
;; doesn't give any CONNECTIONESTABLISHED kind of message, and
;; most IRC servers send nothing and wait for you to identify.
(sit-for 5)
proc)))
(defalias 'erc-ssl 'erc-tls)
(defun erc-tls (&rest r)
"Interactively select TLS connection parameters and run ERC.
......@@ -2200,18 +2173,12 @@ Arguments are the same as for `erc'."
(let ((erc-server-connect-function 'erc-open-tls-stream))
(apply 'erc r)))
(declare-function open-tls-stream "tls" (name buffer host port))
(defun erc-open-tls-stream (name buffer host port)
"Open an TLS stream to an IRC server.
The process will be given the name NAME, its target buffer will be
BUFFER. HOST and PORT specify the connection target."
(when (condition-case nil
(require 'tls)
(error (message "You don't have tls.el. %s"
"Try using `erc-ssl' instead.")
nil))
(open-tls-stream name buffer host port)))
(open-network-stream name buffer host port
:type 'tls))
;;; Displaying error messages
......
2011-06-22 Lars Magne Ingebrigtsen <larsi@gnus.org>
* auth-source.el (auth-source-netrc-create): Don't query the bits that
we already know.
(auth-source-forget-all-cached): Clear auth-source-netrc-cache, too.
(auth-source-netrc-create): Don't prompt for the stuff we already know.
2011-06-21 Lars Magne Ingebrigtsen <larsi@gnus.org>
* auth-source.el (auth-source-netrc-create): Don't print all tokens in
......
......@@ -420,9 +420,9 @@ textual parts.")
(nnimap-login (car credentials) (cadr credentials))))
(if (car login-result)
(progn
;; Save the credentials if a save function exists
;; (such a function will only be passed if a new
;; token was created).
;; Save the credentials if a save function exists
;; (such a function will only be passed if a new
;; token was created).
(when (functionp (nth 2 credentials))
(funcall (nth 2 credentials)))
;; See if CAPABILITY is set as part of login
......
......@@ -1333,12 +1333,16 @@ attachments as specfied by `rmail-mime-attachment-dirs-alist'."
(setq rmail-show-mime-function 'rmail-show-mime)
(defun rmail-insert-mime-forwarded-message (forward-buffer)
"Function to set in `rmail-insert-mime-forwarded-message-function' (which see)."
(let ((rmail-mime-mbox-buffer
(with-current-buffer forward-buffer rmail-view-buffer)))
"Insert the message in FORWARD-BUFFER as a forwarded message.
This is the usual value of `rmail-insert-mime-forwarded-message-function'."
(let ((message-buffer
(with-current-buffer forward-buffer
(if rmail-buffer-swapped
forward-buffer
rmail-view-buffer))))
(save-restriction
(narrow-to-region (point) (point))
(message-forward-make-body-mime rmail-mime-mbox-buffer))))
(message-forward-make-body-mime message-buffer))))
(setq rmail-insert-mime-forwarded-message-function
'rmail-insert-mime-forwarded-message)
......
......@@ -806,10 +806,18 @@ Prefix arg means don't delete this window."
(defun mail-bury (&optional arg)
"Bury this mail buffer."
(let ((newbuf (other-buffer (current-buffer))))
(let ((newbuf (other-buffer (current-buffer)))
(return-action mail-return-action)
some-rmail)
(bury-buffer (current-buffer))
(if (and (null arg) mail-return-action)
(apply (car mail-return-action) (cdr mail-return-action))
;; If there is an Rmail buffer, return to it nicely
;; even if this message was not started by an Rmail command.
(unless return-action
(dolist (buffer (buffer-list))
(if (eq (buffer-local-value 'major-mode buffer) 'rmail-mode)
(setq return-action `(rmail-mail-return ,newbuf)))))
(if (and (null arg) return-action)
(apply (car return-action) (cdr return-action))
(switch-to-buffer newbuf))))
(defcustom mail-send-hook nil
......
......@@ -2710,7 +2710,40 @@ filter out additional entries (because TABLE migth not obey PRED)."
(let ((newstr (completion-initials-expand string table pred)))
(when newstr
(completion-pcm-try-completion newstr table pred (length newstr)))))
(defvar completing-read-function 'completing-read-default
"The function called by `completing-read' to do its work.
It should accept the same arguments as `completing-read'.")
(defun completing-read-default (prompt collection &optional predicate
require-match initial-input
hist def inherit-input-method)
"Default method for reading from the minibuffer with completion.
See `completing-read' for the meaning of the arguments."
(when (consp initial-input)
(setq initial-input
(cons (car initial-input)
;; `completing-read' uses 0-based index while
;; `read-from-minibuffer' uses 1-based index.
(1+ (cdr initial-input)))))
(let* ((minibuffer-completion-table collection)
(minibuffer-completion-predicate predicate)
(minibuffer-completion-confirm (unless (eq require-match t)
require-match))
(keymap (if require-match
(if (memq minibuffer-completing-file-name '(nil lambda))
minibuffer-local-must-match-map
minibuffer-local-filename-must-match-map)
(if (memq minibuffer-completing-file-name '(nil lambda))
minibuffer-local-completion-map
minibuffer-local-filename-completion-map)))
(result (read-from-minibuffer prompt initial-input keymap
nil hist def inherit-input-method)))
(when (and (equal result "") def)
(setq result (if (consp def) (car def) def)))
result))
;; Miscellaneous
......
2011-06-23 Paul Eggert <eggert@cs.ucla.edu>
Integer and buffer overflow fixes (Bug#8873).
* print.c (printchar, strout): Check for string overflow.
(PRINTPREPARE, printchar, strout):
Don't set size unless allocation succeeds.
......@@ -33,8 +35,6 @@
* image.c (cache_image): Check for size arithmetic overflow.
2011-06-22 Paul Eggert <eggert@cs.ucla.edu>
* lread.c: Integer overflow issues.
(saved_doc_string_size, saved_doc_string_length)
(prev_saved_doc_string_size, prev_saved_doc_string_length):
......@@ -44,6 +44,13 @@
(read_list): Don't assume file position fits in int.
(read_escape): Check for hex character overflow.
2011-06-22 Leo Liu <sdl.web@gmail.com>
* minibuf.c (Fcompleting_read_default, Vcompleting_read_function):
Move to minibuffer.el.
2011-06-22 Paul Eggert <eggert@cs.ucla.edu>
Fixes for GLYPH_DEBUG found by GCC 4.6.0 static checking.
The following patches are for when GLYPH_DEBUG && !XASSERT.
* dispextern.h (trace_redisplay_p, dump_glyph_string):
......
......@@ -72,7 +72,6 @@ Lisp_Object Qcompletion_ignore_case;
static Lisp_Object Qminibuffer_completion_table;
static Lisp_Object Qminibuffer_completion_predicate;
static Lisp_Object Qminibuffer_completion_confirm;
static Lisp_Object Qcompleting_read_default;
static Lisp_Object Quser_variable_p;
static Lisp_Object Qminibuffer_default;
......@@ -1692,7 +1691,7 @@ See also `completing-read-function'. */)
(Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method)
{
Lisp_Object args[9];
args[0] = Vcompleting_read_function;
args[0] = Fsymbol_value (intern ("completing-read-function"));
args[1] = prompt;
args[2] = collection;
args[3] = predicate;
......@@ -1703,76 +1702,6 @@ See also `completing-read-function'. */)
args[8] = inherit_input_method;
return Ffuncall (9, args);
}
DEFUN ("completing-read-default", Fcompleting_read_default, Scompleting_read_default, 2, 8, 0,
doc: /* Default method for reading from the minibuffer with completion.
See `completing-read' for the meaning of the arguments. */)
(Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method)
{
Lisp_Object val, histvar, histpos, position;
Lisp_Object init;
int pos = 0;
int count = SPECPDL_INDEX ();
struct gcpro gcpro1;
init = initial_input;
GCPRO1 (def);
specbind (Qminibuffer_completion_table, collection);
specbind (Qminibuffer_completion_predicate, predicate);
specbind (Qminibuffer_completion_confirm,
EQ (require_match, Qt) ? Qnil : require_match);
position = Qnil;
if (!NILP (init))
{
if (CONSP (init))
{
position = Fcdr (init);
init = Fcar (init);
}
CHECK_STRING (init);
if (!NILP (position))
{
CHECK_NUMBER (position);
/* Convert to distance from end of input. */
pos = XINT (position) - SCHARS (init);
}
}
if (SYMBOLP (hist))
{
histvar = hist;
histpos = Qnil;
}
else
{
histvar = Fcar_safe (hist);
histpos = Fcdr_safe (hist);
}
if (NILP (histvar))
histvar = Qminibuffer_history;
if (NILP (histpos))
XSETFASTINT (histpos, 0);
val = read_minibuf (NILP (require_match)
? (NILP (Vminibuffer_completing_file_name)
|| EQ (Vminibuffer_completing_file_name, Qlambda)
? Vminibuffer_local_completion_map
: Vminibuffer_local_filename_completion_map)
: (NILP (Vminibuffer_completing_file_name)
|| EQ (Vminibuffer_completing_file_name, Qlambda)
? Vminibuffer_local_must_match_map
: Vminibuffer_local_filename_must_match_map),
init, prompt, make_number (pos), 0,
histvar, histpos, def, 0,
!NILP (inherit_input_method));
if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def))
val = CONSP (def) ? XCAR (def) : def;
RETURN_UNGCPRO (unbind_to (count, val));
}
Lisp_Object Fassoc_string (register Lisp_Object key, Lisp_Object list, Lisp_Object case_fold);
......@@ -2011,7 +1940,6 @@ syms_of_minibuf (void)
minibuf_save_list = Qnil;
staticpro (&minibuf_save_list);
DEFSYM (Qcompleting_read_default, "completing-read-default");
DEFSYM (Qcompletion_ignore_case, "completion-ignore-case");
DEFSYM (Qread_file_name_internal, "read-file-name-internal");
DEFSYM (Qminibuffer_default, "minibuffer-default");
......@@ -2130,12 +2058,6 @@ If the value is `confirm-after-completion', the user may exit with an
doc: /* Non-nil means completing file names. */);
Vminibuffer_completing_file_name = Qnil;
DEFVAR_LISP ("completing-read-function",
Vcompleting_read_function,
doc: /* The function called by `completing-read' to do the work.
It should accept the same arguments as `completing-read'. */);
Vcompleting_read_function = Qcompleting_read_default;
DEFVAR_LISP ("minibuffer-help-form", Vminibuffer_help_form,
doc: /* Value that `help-form' takes on inside the minibuffer. */);
Vminibuffer_help_form = Qnil;
......@@ -2212,5 +2134,4 @@ properties. */);
defsubr (&Stest_completion);
defsubr (&Sassoc_string);
defsubr (&Scompleting_read);
defsubr (&Scompleting_read_default);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment