commit 291593a0571dd62ae809ed337aca8b9e62a5fddc (HEAD, refs/remotes/origin/master) Author: Nicolas Petton Date: Mon Aug 24 10:12:31 2015 +0200 Fix cl-subseq and cl-concatenate * lisp/emacs-lisp/cl-extra.el (cl-subseq, cl-concatenate): Do not use seq functions. * lisp/emacs-lisp/seq.el (seq-concatenate): Call cl-concatenate in seq-concatenate. diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 90ca531..7a7712a 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -529,8 +529,8 @@ too large if positive or too small if negative)." ((listp seq) (let (len (errtext (format "Bad bounding indices: %s, %s" start end))) - (and end (< end 0) (setq end (+ end (setq len (seq-length seq))))) - (if (< start 0) (setq start (+ start (or len (setq len (seq-length seq)))))) + (and end (< end 0) (setq end (+ end (setq len (length seq))))) + (if (< start 0) (setq start (+ start (or len (setq len (length seq)))))) (unless (>= start 0) (error "%s" errtext)) (when (> start 0) @@ -543,14 +543,18 @@ too large if positive or too small if negative)." (push (pop seq) res)) (or (= (1+ end) start) (error "%s" errtext)) (nreverse res)) - (seq-copy seq)))) + (copy-sequence seq)))) (t (error "Unsupported sequence: %s" seq)))) ;;;###autoload -(defalias 'cl-concatenate #'seq-concatenate +(defun cl-concatenate (type &rest sequences) "Concatenate, into a sequence of type TYPE, the argument SEQUENCEs. -\n(fn TYPE SEQUENCE...)") - +\n(fn TYPE SEQUENCE...)" + (pcase type + (`vector (apply #'vconcat sequences)) + (`string (apply #'concat sequences)) + (`list (apply #'append (append sequences '(nil)))) + (_ (error "Not a sequence type name: %S" type)))) ;;; List functions. diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 5ce4d91..6a386bd 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -200,11 +200,7 @@ The result is a sequence of the same type as SEQ." TYPE must be one of following symbols: vector, string or list. \n(fn TYPE SEQUENCE...)" - (pcase type - (`vector (apply #'vconcat seqs)) - (`string (apply #'concat seqs)) - (`list (apply #'append (append seqs '(nil)))) - (_ (error "Not a sequence type name: %S" type)))) + (apply #'cl-concatenate type seqs)) (cl-defgeneric seq-into (seq type) "Convert the sequence SEQ into a sequence of type TYPE. commit 24c61cab074c81da00785bedb62eb0be95fd9776 Author: Martin Rudalics Date: Mon Aug 24 09:48:56 2015 +0200 ; Fix two entries in ChangeLog.2 diff --git a/ChangeLog.2 b/ChangeLog.2 index 2286a82..15cb656 100644 --- a/ChangeLog.2 +++ b/ChangeLog.2 @@ -344,13 +344,13 @@ 2015-08-21 Vasilij Schneidermann - In `ielm' use `pop-to-buffer-same-window' instead of `switch-to-buffer' + In `ielm' use `pop-to-buffer-same-window' (Bug#20848) * lisp/ielm.el (ielm): Use `pop-to-buffer-same-window' instead of `switch-to-buffer'. -2015-08-21 Kaushal (tiny change) +2015-08-21 Kaushal Modi (tiny change) - In woman.el use `display-buffer' instead of `switch-to-buffer' + In woman.el use `display-buffer' instead of `switch-to-buffer' (Bug#21047) * lisp/woman.el (woman-really-find-file, WoMan-find-buffer): Use `display-buffer' instead of `switch-to-buffer'. commit 93da8ac5d79e742e1b1391f449c0456b9eb1f534 Author: Pip Cet Date: Mon Aug 24 09:41:35 2015 +0200 Fix full-screen code when there is no window manager (Bug#21317) * src/xterm.h (x_wm_supports): Declare external. * src/xterm.c (wm_suppports): Rename to `x_wm_supports', export. (do_ewmh_fullscreen, x_ewmh_activate_frame): Adjust for rename. (x_check_fullscreen): Call `x_wm_set_size_hint', restore `fullscreen' frame parameter. * gtkutil.c (x_wm_set_size_hint): Set size hints when running without a window manager. Copyright-paperwork-exempt: yes diff --git a/src/gtkutil.c b/src/gtkutil.c index d684cd9..5fc2beb 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1375,7 +1375,9 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) XSETFRAME (frame, f); fs_state = Fframe_parameter (frame, Qfullscreen); - if (EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth)) + if ((EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth)) && + (x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state) || + x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state_fullscreen))) { /* Don't set hints when maximized or fullscreen. Apparently KWin and Gtk3 don't get along and the frame shrinks (!). diff --git a/src/xterm.c b/src/xterm.c index b7aacfa..7bb2032 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9782,8 +9782,8 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_ Specification/Extended Window Manager Hints at http://freedesktop.org/wiki/Specifications/wm-spec. */ -static bool -wm_supports (struct frame *f, Atom want_atom) +bool +x_wm_supports (struct frame *f, Atom want_atom) { Atom actual_type; unsigned long actual_size, bytes_remaining; @@ -9976,7 +9976,7 @@ static bool do_ewmh_fullscreen (struct frame *f) { struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); - bool have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state); + bool have_net_atom = x_wm_supports (f, dpyinfo->Xatom_net_wm_state); int cur; bool dummy; @@ -9985,7 +9985,7 @@ do_ewmh_fullscreen (struct frame *f) /* Some window managers don't say they support _NET_WM_STATE, but they do say they support _NET_WM_STATE_FULLSCREEN. Try that also. */ if (!have_net_atom) - have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen); + have_net_atom = x_wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen); if (have_net_atom && cur != f->want_fullscreen) { @@ -10155,6 +10155,8 @@ x_handle_net_wm_state (struct frame *f, const XPropertyEvent *event) static void x_check_fullscreen (struct frame *f) { + Lisp_Object lval = Qnil; + if (do_ewmh_fullscreen (f)) return; @@ -10173,22 +10175,31 @@ x_check_fullscreen (struct frame *f) switch (f->want_fullscreen) { /* No difference between these two when there is no WM */ - case FULLSCREEN_BOTH: case FULLSCREEN_MAXIMIZED: + lval = Qmaximized; + width = x_display_pixel_width (dpyinfo); + height = x_display_pixel_height (dpyinfo); + break; + case FULLSCREEN_BOTH: + lval = Qfullboth; width = x_display_pixel_width (dpyinfo); height = x_display_pixel_height (dpyinfo); break; case FULLSCREEN_WIDTH: + lval = Qfullwidth; width = x_display_pixel_width (dpyinfo); height = height + FRAME_MENUBAR_HEIGHT (f); break; case FULLSCREEN_HEIGHT: + lval = Qfullheight; height = x_display_pixel_height (dpyinfo); } frame_size_history_add (f, Qx_check_fullscreen, width, height, Qnil); + x_wm_set_size_hint (f, 0, false); + XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), width, height); @@ -10201,6 +10212,10 @@ x_check_fullscreen (struct frame *f) x_sync (f); } } + + /* `x_net_wm_state' might have reset the fullscreen frame parameter, + restore it. */ + store_frame_param (f, Qfullscreen, lval); } /* This function is called by x_set_offset to determine whether the window @@ -10564,7 +10579,7 @@ x_ewmh_activate_frame (struct frame *f) struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); - if (FRAME_VISIBLE_P (f) && wm_supports (f, dpyinfo->Xatom_net_active_window)) + if (FRAME_VISIBLE_P (f) && x_wm_supports (f, dpyinfo->Xatom_net_active_window)) { Lisp_Object frame; XSETFRAME (frame, f); diff --git a/src/xterm.h b/src/xterm.h index 5622344..6165906 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -1072,6 +1072,7 @@ x_display_set_last_user_time (struct x_display_info *dpyinfo, Time t) } extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object); +extern bool x_wm_supports (struct frame *, Atom); extern void x_wait_for_event (struct frame *, int); extern void x_clear_under_internal_border (struct frame *f); commit d56d62b13b608cd2d13dd2098f73d2fc7e494819 Author: Glenn Morris Date: Mon Aug 24 00:31:52 2015 -0700 ; * doc/lispref/intro.texi (Version Info): Shorten line for 80 column terminal. diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi index 0db464e..6158bf5 100644 --- a/doc/lispref/intro.texi +++ b/doc/lispref/intro.texi @@ -480,7 +480,7 @@ running. It is useful to include this string in bug reports. @smallexample @group (emacs-version) - @result{} "GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.4) + @result{} "GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16) of 2015-06-01" @end group @end smallexample commit 5a133ba0785b756a3f479ec8acf95ca3f2b48c92 Author: Glenn Morris Date: Mon Aug 24 00:27:53 2015 -0700 * lisp/version.el (emacs-version): No longer include build host * doc/lispref/intro.texi (Version Info): Update example. diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi index 14bdbdb..0db464e 100644 --- a/doc/lispref/intro.texi +++ b/doc/lispref/intro.texi @@ -480,8 +480,8 @@ running. It is useful to include this string in bug reports. @smallexample @group (emacs-version) - @result{} "GNU Emacs 23.1 (i686-pc-linux-gnu, GTK+ Version 2.14.4) - of 2009-06-01 on cyd.mit.edu" + @result{} "GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.4) + of 2015-06-01" @end group @end smallexample diff --git a/lisp/version.el b/lisp/version.el index c0b975e..43103fd 100644 --- a/lisp/version.el +++ b/lisp/version.el @@ -41,6 +41,8 @@ This variable first existed in version 19.23.") (defconst emacs-build-time (current-time) "Time at which Emacs was dumped out.") +;; I think this should be obsoleted/removed. It's just one more meaningless +;; difference between different builds. It's usually not even an fqdn. (defconst emacs-build-system (system-name) "Name of the system on which Emacs was built.") @@ -57,8 +59,8 @@ to the system configuration; look at `system-configuration' instead." (interactive "P") (let ((version-string (format (if (not (called-interactively-p 'interactive)) - "GNU Emacs %s (%s%s%s%s)\n of %s on %s" - "GNU Emacs %s (%s%s%s%s) of %s on %s") + "GNU Emacs %s (%s%s%s%s)\n of %s" + "GNU Emacs %s (%s%s%s%s) of %s") emacs-version system-configuration (cond ((featurep 'motif) @@ -77,8 +79,7 @@ to the system configuration; look at `system-configuration' instead." (format ", %s scroll bars" (capitalize (symbol-name x-toolkit-scroll-bars))) "") - (format-time-string "%Y-%m-%d" emacs-build-time) - emacs-build-system))) + (format-time-string "%Y-%m-%d" emacs-build-time)))) (if here (insert version-string) (if (called-interactively-p 'interactive) commit a19b8550f3db9a0984e940260a5132275daf29ea Author: Paul Eggert Date: Sun Aug 23 23:35:45 2015 -0700 * doc/lispref/elisp.texi: Fix typo in previous change. diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 48c531f..9044fba 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -375,7 +375,6 @@ Strings and Characters * Text Comparison:: Comparing characters or strings. * String Conversion:: Converting to and from characters and strings. * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. -* Text Restyling:: Text style conversion function. * Case Conversion:: Case conversion functions. * Case Tables:: Customizing case conversion. commit fbb5531fa11d13854b274d28ccd329c9b6652cfc Author: Paul Eggert Date: Sun Aug 23 22:38:02 2015 -0700 More-conservative ‘format’ quote restyling Instead of restyling curved quotes for every call to ‘format’, create a new function ‘format-message’ that does the restyling, and using the new function instead of ‘format’ only in contexts where this seems appropriate. Problem reported by Dmitry Gutov and Andreas Schwab in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html * doc/lispref/commands.texi (Using Interactive): * doc/lispref/control.texi (Signaling Errors, Signaling Errors): * doc/lispref/display.texi (Displaying Messages, Progress): * doc/lispref/elisp.texi: * doc/lispref/help.texi (Keys in Documentation): * doc/lispref/minibuf.texi (Minibuffer Misc): * doc/lispref/strings.texi (Formatting Strings): * etc/NEWS: Document the changes. * lisp/abbrev.el (expand-region-abbrevs): * lisp/apropos.el (apropos-library): * lisp/calc/calc-ext.el (calc-record-message) (calc-user-function-list): * lisp/calc/calc-help.el (calc-describe-key, calc-full-help): * lisp/calc/calc-lang.el (math-read-big-balance): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--add-diary-entry): * lisp/cedet/mode-local.el (mode-local-print-binding) (mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-completion-message): * lisp/cedet/semantic/edit.el (semantic-parse-changes-failed): * lisp/cedet/semantic/wisent/comp.el (wisent-log): * lisp/cedet/srecode/insert.el (srecode-insert-show-error-report): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dframe.el (dframe-message): * lisp/dired-aux.el (dired-query): * lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1): * lisp/emacs-lisp/bytecomp.el (byte-compile-log) (byte-compile-log-file, byte-compile-warn, byte-compile-form): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use) (cconv-analyze-form): * lisp/emacs-lisp/check-declare.el (check-declare-warn): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): * lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet): * lisp/emacs-lisp/edebug.el (edebug-format): * lisp/emacs-lisp/eieio-core.el (eieio-oref): * lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message) (eldoc-message): * lisp/emacs-lisp/elint.el (elint-file, elint-log): * lisp/emacs-lisp/find-func.el (find-function-library): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring): * lisp/emacs-lisp/package.el (package-compute-transaction) (package-install-button-action, package-delete-button-action) (package-menu--list-to-prompt): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emacs-lisp/warnings.el (lwarn, warn): * lisp/emulation/viper-cmd.el: (viper-toggle-parse-sexp-ignore-comments) (viper-kill-buffer, viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/facemenu.el (facemenu-add-new-face): * lisp/faces.el (face-documentation, read-face-name) (face-read-string, read-face-font, describe-face): * lisp/files.el (find-alternate-file, hack-local-variables) (hack-one-local-variable--obsolete, write-file) (basic-save-buffer, delete-directory): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--obsolete) (help-fns--interactive-only, describe-function-1) (describe-variable): * lisp/help.el (describe-mode): * lisp/info-xref.el (info-xref-output): * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): * lisp/international/kkc.el (kkc-error): * lisp/international/mule-cmds.el: (select-safe-coding-system-interactively) (select-safe-coding-system, describe-input-method): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/international/quail.el (quail-error): * lisp/minibuffer.el (minibuffer-message): * lisp/mpc.el (mpc--debug): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-message): * lisp/net/gnutls.el (gnutls-message-maybe): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/nsm.el (nsm-query-user): * lisp/net/rlogin.el (rlogin): * lisp/net/soap-client.el (soap-warning): * lisp/net/tramp.el (tramp-debug-message): * lisp/nxml/nxml-outln.el (nxml-report-outline-error): * lisp/nxml/nxml-parse.el (nxml-parse-error): * lisp/nxml/rng-cmpct.el (rng-c-error): * lisp/nxml/rng-match.el (rng-compile-error): * lisp/nxml/rng-uri.el (rng-uri-error): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/org/org-ctags.el: (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/proced.el (proced-log): * lisp/progmodes/ebnf2ps.el (ebnf-log): * lisp/progmodes/flymake.el (flymake-log): * lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle): * lisp/replace.el (occur-1): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, define-alternatives): * lisp/startup.el (command-line): * lisp/subr.el (error, user-error, add-to-list): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * src/callint.c (Fcall_interactively): * src/editfns.c (Fmessage, Fmessage_box): Restyle the quotes of format strings intended for use as a diagnostic, when restyling seems appropriate. * lisp/subr.el (format-message): New function. * src/doc.c (Finternal__text_restyle): New function. (syms_of_doc): Define it. diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index aec7674..5930540 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -211,7 +211,7 @@ argument. The prompt string can use @samp{%} to include previous argument values (starting with the first argument) in the prompt. This is done using -@code{format} (@pxref{Formatting Strings}). For example, here is how +@code{format-message} (@pxref{Formatting Strings}). For example, here is how you could read the name of an existing buffer followed by a new name to give to that buffer: diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index 17d5c26..421f5cc 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -990,7 +990,7 @@ should not end with any sort of punctuation. @defun error format-string &rest args This function signals an error with an error message constructed by -applying @code{format} (@pxref{Formatting Strings}) to +applying @code{format-message} (@pxref{Formatting Strings}) to @var{format-string} and @var{args}. These examples show typical uses of @code{error}: @@ -1009,7 +1009,7 @@ These examples show typical uses of @code{error}: @code{error} works by calling @code{signal} with two arguments: the error symbol @code{error}, and a list containing the string returned by -@code{format}. +@code{format-message}. @strong{Warning:} If you want to use your own string as an error message verbatim, don't just write @code{(error @var{string})}. If @var{string} diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index ae59bbb..36404f4 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -247,7 +247,7 @@ messages in the echo area. @defun message format-string &rest arguments This function displays a message in the echo area. @var{format-string} is a format string, and @var{arguments} are the -objects for its format specifications, like in the @code{format} +objects for its format specifications, like in the @code{format-message} function (@pxref{Formatting Strings}). The resulting formatted string is displayed in the echo area; if it contains @code{face} text properties, it is displayed with the specified faces (@pxref{Faces}). @@ -375,7 +375,7 @@ reporting very fast. When this progress reporter is subsequently used, it will display @var{message} in the echo area, followed by progress percentage. @var{message} is treated as a simple string. If you need it to depend -on a filename, for instance, use @code{format} before calling this +on a filename, for instance, use @code{format-message} before calling this function. The arguments @var{min-value} and @var{max-value} should be numbers diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 9044fba..48c531f 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -375,6 +375,7 @@ Strings and Characters * Text Comparison:: Comparing characters or strings. * String Conversion:: Converting to and from characters and strings. * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. +* Text Restyling:: Text style conversion function. * Case Conversion:: Case conversion functions. * Case Tables:: Customizing case conversion. diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index ca8ae3f..ab884f8 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi @@ -350,8 +350,7 @@ string in Emacs Lisp. @defvar text-quoting-style @cindex curved quotes @cindex curly quotes -The value of this variable specifies the style -@code{substitute-command-keys} uses when generating left and right +The value of this variable specifies the style used to generate text quotes. If the variable's value is @code{curve}, the style is @t{‘like this’} with curved single quotes. If the value is @code{straight}, the style is @t{'like this'} with straight diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 24c7559..2aec149 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2413,7 +2413,7 @@ arrives, whichever comes first. The variable @code{minibuffer-message-timeout} specifies the number of seconds to wait in the absence of input. It defaults to 2. If @var{args} is non-@code{nil}, the actual message is obtained by passing @var{string} -and @var{args} through @code{format}. @xref{Formatting Strings}. +and @var{args} through @code{format-message}. @xref{Formatting Strings}. @end defun @deffn Command minibuffer-inactive-mode diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index c4556cb..326359e 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -801,7 +801,7 @@ they appear; it is called a @dfn{format string}. Formatting is often useful for computing messages to be displayed. In fact, the functions @code{message} and @code{error} provide the same -formatting feature described here; they differ from @code{format} only +formatting feature described here; they differ from @code{format-message} only in how they use the result of formatting. @defun format string &rest objects @@ -815,6 +815,12 @@ are copied directly into the output, including their text properties, if any. @end defun +@defun format-message string &rest objects +This function acts like @code{format}, except it also converts any +curved quotes in @var{string} as per the value of +@code{text-quoting-style}. @xref{Keys in Documentation}. +@end defun + @cindex @samp{%} in format @cindex format specification A format specification is a sequence of characters beginning with a diff --git a/etc/NEWS b/etc/NEWS index 42a5e14..90a13b7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -917,6 +917,12 @@ either curved quotes or grave accent and apostrophe. As before, isolated apostrophes and characters preceded by \= are output as-is. +++ +** Message-issuing functions ‘error’, ‘message’, etc. now convert quotes. +They use the new ‘format-message’ function instead of plain ‘format’, +so that they now follow user preference as per ‘text-quoting-style’ if +their format argument contains curved quotes. + ++++ ** The character classes [:alpha:] and [:alnum:] in regular expressions now match multibyte characters using Unicode character properties. If you want the old behavior where they matched any character with @@ -1039,6 +1045,10 @@ key works) by typing ‘A-[’ and ‘A-]’. As described above under quotes. +++ +** New function ‘format-message’ is like ‘format’ and also converts +curved quotes as per ‘text-quoting-style’. + ++++ ** New ‘format’ flag ‘q’ The new ‘q’ flag causes ‘format’ to quote the output representation as per the value of ‘text-quoting-style’. E.g., (format "%qs failed" diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 02b9fd7..0ba21da 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -399,7 +399,7 @@ A prefix argument means don't query; expand all abbrevs." (buffer-substring-no-properties (save-excursion (forward-word -1) (point)) pnt))) - (if (or noquery (y-or-n-p (format "Expand ‘%s’? " string))) + (if (or noquery (y-or-n-p (format-message "Expand ‘%s’? " string))) (expand-abbrev))))))) ;;; Abbrev properties. diff --git a/lisp/apropos.el b/lisp/apropos.el index 0a1bc7b..38b583c 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -681,8 +681,8 @@ the output includes key-bindings of commands." (apropos-symbols-internal symbols apropos-do-all (concat - (format (substitute-command-keys - "Library `%s' provides: %s\nand requires: %s") + (format-message + "Library ‘%s’ provides: %s\nand requires: %s" file (mapconcat 'apropos-library-button (or provides '(nil)) " and ") diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index 1c40188..bd33fbe 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1245,7 +1245,7 @@ calc-kill calc-kill-region calc-yank)))) (defun calc-record-message (tag &rest args) - (let ((msg (apply 'format args))) + (let ((msg (apply #'format-message args))) (message "%s" msg) (calc-record msg tag)) (calc-clear-command-flag 'clear-message)) @@ -1957,7 +1957,7 @@ calc-kill calc-kill-region calc-yank)))) (desc (if (symbolp func) (if (= (logand kind 3) 0) - (format "‘%c’ = %s" key name) + (format-message "‘%c’ = %s" key name) (if pos (format "%s%c%s" (downcase (substring name 0 pos)) diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el index 50a0291..18c3b76 100644 --- a/lisp/calc/calc-help.el +++ b/lisp/calc/calc-help.el @@ -239,7 +239,7 @@ C-w Describe how there is no warranty for Calc." (setq prompts (substring prompts 0 (match-beginning 0)))) (if (string-match "\\` +" prompts) (setq prompts (substring prompts (match-end 0)))) - (setq msg (format + (setq msg (format-message "%s: %s%s‘%s’%s%s %s%s" (if (string-match "\\`\\(calc-[-a-zA-Z0-9]+\\) *\\(.*\\)\\'" @@ -400,8 +400,9 @@ C-w Describe how there is no warranty for Calc." (princ "GNU Emacs Calculator.\n") (princ " By Dave Gillespie.\n") (princ (format " %s\n\n" emacs-copyright)) - (princ (format "Type ‘h s’ for a more detailed summary.\n")) - (princ (format "Or type ‘h i’ to read the full Calc manual on-line.\n\n")) + (princ (format-message "Type ‘h s’ for a more detailed summary.\n")) + (princ (format-message + "Or type ‘h i’ to read the full Calc manual on-line.\n\n")) (princ "Basic keys:\n") (let* ((calc-full-help-flag t)) (mapc (function (lambda (x) (princ (format @@ -415,10 +416,10 @@ C-w Describe how there is no warranty for Calc." (if (car msgs) (princ (if (eq (nth 2 msgs) ?v) - (format + (format-message "\n‘v’ or ‘V’ prefix (vector/matrix) keys: \n") (if (nth 2 msgs) - (format + (format-message "\n‘%c’ prefix (%s) keys:\n" (nth 2 msgs) (or (cdr (assq (nth 2 msgs) diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el index 9d5020d..7f5588b 100644 --- a/lisp/calc/calc-lang.el +++ b/lisp/calc/calc-lang.el @@ -2508,7 +2508,8 @@ order to Calc's." (while (> count 0) (if (>= h len) (if what - (math-read-big-error nil v (format "Unmatched ‘%s’" what)) + (math-read-big-error nil v (format-message + "Unmatched ‘%s’" what)) (setq count 0)) (if (memq (aref line h) '(?\( ?\[)) (setq count (1+ count)) diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index 43dc602..4cf5b8c 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -442,7 +442,8 @@ (setq calc-last-edited-variable var) (calc-edit-mode (list 'calc-finish-stack-edit (list 'quote var)) t - (format "Editing variable ‘%s’" (calc-var-name var))) + (format-message + "Editing variable ‘%s’" (calc-var-name var))) (and value (insert (math-format-nice-expr value (frame-width)) "\n"))))) (calc-show-edit-buffer)) diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index d95af94..d56c0b2 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -1622,7 +1622,7 @@ If COMP or STD is non-nil, put that in the units table instead." (while (eq (car (car (setq uptr (cdr uptr)))) 0))) (insert "\n\n") (insert - (format + (format-message (concat "(**) When in TeX or LaTeX display mode, the TeX specific unit\n" "names will not use the ‘tex’ prefix; the unit name for a\n" diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el index d4be8ad..cce0470 100644 --- a/lisp/calc/calc-yank.el +++ b/lisp/calc/calc-yank.el @@ -603,9 +603,9 @@ To cancel the edit, simply kill the *Calc Edit* buffer." (insert (propertize (concat (or title title "Calc Edit Mode. ") - (format "Press ‘C-c C-c’") + (format-message "Press ‘C-c C-c’") (if allow-ret "" " or RET") - (format " to finish, ‘C-x k RET’ to cancel.\n\n")) + (format-message " to finish, ‘C-x k RET’ to cancel.\n\n")) 'font-lock-face 'italic 'read-only t 'rear-nonsticky t 'front-sticky t)) (make-local-variable 'calc-edit-top) (setq calc-edit-top (point)))) diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index bced4e2..bd78ba3 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -1118,10 +1118,10 @@ FExport diary data into iCalendar file: ") (setq found-error t) (save-current-buffer (set-buffer (get-buffer-create "*icalendar-errors*")) - (insert (format "Error in line %d -- %s: ‘%s’\n" - (count-lines (point-min) (point)) - error-val - entry-main)))))) + (insert (format-message "Error in line %d -- %s: ‘%s’\n" + (count-lines (point-min) (point)) + error-val + entry-main)))))) ;; we're done, insert everything into the file (save-current-buffer @@ -2473,8 +2473,8 @@ SUMMARY is not nil it must be a string that gives the summary of the entry. In this case the user will be asked whether he wants to insert the entry." (when (or (not summary) - (y-or-n-p (format "Add appointment for ‘%s’ to diary? " - summary))) + (y-or-n-p (format-message "Add appointment for ‘%s’ to diary? " + summary))) (when summary (setq non-marking (y-or-n-p (format "Make appointment non-marking? ")))) diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index 3bdc3ea..01e3700 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -629,10 +629,9 @@ SYMBOL is a function that can be overridden." (defun mode-local-print-binding (symbol) "Print the SYMBOL binding." (let ((value (symbol-value symbol))) - (princ (format (substitute-command-keys "\n ‘%s’ value is\n ") - symbol)) + (princ (format-message "\n ‘%s’ value is\n " symbol)) (if (and value (symbolp value)) - (princ (format (substitute-command-keys "‘%s’") value)) + (princ (format-message "‘%s’" value)) (let ((pt (point))) (pp value) (save-excursion @@ -690,7 +689,7 @@ SYMBOL is a function that can be overridden." ) ((symbolp buffer-or-mode) (setq mode buffer-or-mode) - (princ (format (substitute-command-keys "‘%s’\n") buffer-or-mode)) + (princ (format-message "‘%s’\n" buffer-or-mode)) ) ((signal 'wrong-type-argument (list 'buffer-or-mode buffer-or-mode)))) @@ -700,7 +699,7 @@ SYMBOL is a function that can be overridden." (while mode (setq table (get mode 'mode-local-symbol-table)) (when table - (princ (format (substitute-command-keys "\n- From ‘%s’\n") mode)) + (princ (format-message "\n- From ‘%s’\n" mode)) (mode-local-print-bindings table)) (setq mode (get-mode-local-parent mode))))) diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el index 509f802..ce9e325 100644 --- a/lisp/cedet/semantic/complete.el +++ b/lisp/cedet/semantic/complete.el @@ -156,7 +156,7 @@ Presumably if you call this you will insert something new there." "Display the string FMT formatted with ARGS at the end of the minibuffer." (if semantic-complete-inline-overlay (apply 'message fmt args) - (message (concat (buffer-string) (apply 'format fmt args))))) + (message (concat (buffer-string) (apply #'format-message fmt args))))) ;;; ------------------------------------------------------------ ;;; MINIBUFFER: Option Selection harnesses diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el index f207fce..aa7131e 100644 --- a/lisp/cedet/semantic/edit.el +++ b/lisp/cedet/semantic/edit.el @@ -463,11 +463,11 @@ See `semantic-edits-change-leaf-tag' for details on parents." (defun semantic-parse-changes-failed (&rest args) "Signal that Semantic failed to parse changes. -That is, display a message by passing all ARGS to `format', then throw +That is, display a message by passing all ARGS to `format-message', then throw a 'semantic-parse-changes-failed exception with value t." (when semantic-edits-verbose-flag (message "Semantic parse changes failed: %S" - (apply 'format args))) + (apply #'format-message args))) (throw 'semantic-parse-changes-failed t)) (defsubst semantic-edits-incremental-fail () diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el index 2e4072f..90c5ebd 100644 --- a/lisp/cedet/semantic/wisent/comp.el +++ b/lisp/cedet/semantic/wisent/comp.el @@ -230,11 +230,11 @@ Its name is defined in constant `wisent-log-buffer-name'." (defsubst wisent-log (&rest args) "Insert text into the log buffer. -`format' is applied to ARGS and the result string is inserted into the +`format-message' is applied to ARGS and the result string is inserted into the log buffer returned by the function `wisent-log-buffer'." (and wisent-new-log-flag (wisent-new-log)) (with-current-buffer (wisent-log-buffer) - (insert (apply 'format args)))) + (insert (apply #'format-message args)))) (defconst wisent-log-file "wisent.output" "The log file. diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el index c2a70fe..c24bd99 100644 --- a/lisp/cedet/srecode/insert.el +++ b/lisp/cedet/srecode/insert.el @@ -216,7 +216,7 @@ insertions." (data-debug-insert-thing dictionary "" "> ") ;; Show the error message. (insert (propertize "Error" 'face '(:weight bold)) "\n") - (insert (apply #'format format args)) + (insert (apply #'format-message format args)) (pop-to-buffer (current-buffer)))) (defun srecode-insert-report-error (dictionary format &rest args) diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 71233d4..825ab80 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el @@ -161,11 +161,8 @@ otherwise." ;; Buttons (when (and button (not (widgetp wid-button))) (newline) - (insert (substitute-command-keys "Here is a ‘") - (format "%S" button-type) - (substitute-command-keys "’ button labeled ‘") - button-label - (substitute-command-keys "’.\n\n"))) + (insert (format-message "Here is a ‘%S’ button labeled ‘%s’.\n\n" + button-type button-label))) ;; Overlays (when overlays (newline) @@ -739,9 +736,7 @@ relevant to POS." (when face (insert (propertize " " 'display '(space :align-to 5)) "face: ") - (insert (substitute-command-keys "‘") - (symbol-name face) - (substitute-command-keys "’\n")))))) + (insert (format-message "‘%s’\n" face)))))) (insert "these terminal codes:\n") (dotimes (i (length disp-vector)) (insert (car (aref disp-vector i)) diff --git a/lisp/dframe.el b/lisp/dframe.el index 94c1e10..d8ddbc8 100644 --- a/lisp/dframe.el +++ b/lisp/dframe.el @@ -688,11 +688,11 @@ Optionally select that frame if necessary." Argument FMT is the format string, and ARGS are the arguments for message." (save-selected-window (if dframe-suppress-message-flag - (apply 'format fmt args) + (apply #'format-message fmt args) (if dframe-attached-frame ;; KB: Here we do not need calling `dframe-select-attached-frame' (select-frame dframe-attached-frame)) - (apply 'message fmt args)))) + (apply #'message fmt args)))) (defun dframe-y-or-n-p (prompt) "Like `y-or-n-p', but for use in a dedicated frame. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 18a3c88..63ee75f 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1006,7 +1006,7 @@ return t; if SYM is q or ESC, return nil." nil) ; skip, and don't ask again (t ; no previous answer - ask now (setq prompt - (concat (apply 'format prompt args) + (concat (apply #'format-message prompt args) (if help-form (format " [Type yn!q or %s] " (key-description (vector help-char))) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 490d9a8..716e1c6 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -192,7 +192,7 @@ ;; (if (aref byte-code-vector 0) ;; (error "The old version of the disassembler is loaded. Reload new-bytecomp as well")) (byte-compile-log-1 - (apply 'format format + (apply #'format-message format (let (c a) (mapcar (lambda (arg) (if (not (consp arg)) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 0ae7824..2ac926f 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -973,7 +973,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (print-level 4) (print-length 4)) (byte-compile-log-1 - (format + (format-message ,format-string ,@(mapcar (lambda (x) (if (symbolp x) (list 'prin1-to-string x) x)) @@ -1120,7 +1120,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." pt) (when dir (unless was-same - (insert (format "Leaving directory ‘%s’\n" default-directory)))) + (insert (format-message "Leaving directory ‘%s’\n" + default-directory)))) (unless (bolp) (insert "\n")) (setq pt (point-marker)) @@ -1135,8 +1136,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (when dir (setq default-directory dir) (unless was-same - (insert (format "Entering directory ‘%s’\n" - default-directory)))) + (insert (format-message "Entering directory ‘%s’\n" + default-directory)))) (setq byte-compile-last-logged-file byte-compile-current-file byte-compile-last-warned-form nil) ;; Do this after setting default-directory. @@ -1154,7 +1155,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (defun byte-compile-warn (format &rest args) "Issue a byte compiler warning; use (format FORMAT ARGS...) for message." - (setq format (apply 'format format args)) + (setq format (apply #'format-message format args)) (if byte-compile-error-on-warn (error "%s" format) ; byte-compile-file catches and logs it (byte-compile-log-warning format t :warning))) @@ -2979,7 +2980,7 @@ for symbols generated by the byte compiler itself." (`(',var . ,_) (when (assq var byte-compile-lexical-variables) (byte-compile-log-warning - (format "%s cannot use lexical var ‘%s’" fn var) + (format-message "%s cannot use lexical var ‘%s’" fn var) nil :error))))) (when (macroexp--const-symbol-p fn) (byte-compile-warn "‘%s’ called as a function" fn)) @@ -2991,8 +2992,8 @@ for symbols generated by the byte compiler itself." (format "; %s" interactive-only)) ((and (symbolp 'interactive-only) (not (eq interactive-only t))) - (format "; use ‘%s’ instead." - interactive-only)) + (format-message "; use ‘%s’ instead." + interactive-only)) (t ".")))) (if (eq (car-safe (symbol-function (car form))) 'macro) (byte-compile-log-warning diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index ac5144c..a20e201 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -300,7 +300,8 @@ places where they originally did not directly appear." (prog1 binder (setq binder (list binder))) (when (cddr binder) (byte-compile-log-warning - (format "Malformed ‘%S’ binding: %S" letsym binder))) + (format-message "Malformed ‘%S’ binding: %S" + letsym binder))) (setq value (cadr binder)) (car binder))) (new-val @@ -545,7 +546,7 @@ FORM is the parent form that binds this var." (`((,(and var (guard (eq ?_ (aref (symbol-name var) 0)))) . ,_) ,_ ,_ ,_ ,_) (byte-compile-log-warning - (format "%s ‘%S’ not left unused" varkind var)))) + (format-message "%s ‘%S’ not left unused" varkind var)))) (pcase vardata (`((,var . ,_) nil ,_ ,_ nil) ;; FIXME: This gives warnings in the wrong order, with imprecise line @@ -557,8 +558,8 @@ FORM is the parent form that binds this var." (eq ?_ (aref (symbol-name var) 0)) ;; As a special exception, ignore "ignore". (eq var 'ignored)) - (byte-compile-log-warning (format "Unused lexical %s ‘%S’" - varkind var)))) + (byte-compile-log-warning (format-message "Unused lexical %s ‘%S’" + varkind var)))) ;; If it's unused, there's no point converting it into a cons-cell, even if ;; it's captured and mutated. (`(,binder ,_ t t ,_) @@ -678,7 +679,7 @@ and updates the data stored in ENV." ;; ((and `(quote ,v . ,_) (guard (assq v env))) ;; (byte-compile-log-warning - ;; (format "Possible confusion variable/symbol for ‘%S’" v))) + ;; (format-message "Possible confusion variable/symbol for ‘%S’" v))) (`(quote . ,_) nil) ; quote form (`(function . ,_) nil) ; same as quote diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index 2c2f684..bdcb4ec 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -279,8 +279,8 @@ TYPE is a string giving the nature of the error. Warning is displayed in entry)) (warning-fill-prefix " ")) (display-warning 'check-declare - (format "said ‘%s’ was defined in %s: %s" - fn (file-name-nondirectory fnfile) type) + (format-message "said ‘%s’ was defined in %s: %s" + fn (file-name-nondirectory fnfile) type) nil check-declare-warning-buffer))) (declare-function compilation-forget-errors "compile" ()) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 14c2a1b..ebe21d0 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1714,7 +1714,7 @@ function,command,variable,option or symbol." ms1)))))) e t)) (if (checkdoc-autofix-ask-replace (match-beginning 1) (match-end 1) - (format + (format-message "If this is the argument ‘%s’, it should appear as %s. Fix? " (car args) (upcase (car args))) (upcase (car args)) t) @@ -1740,7 +1740,7 @@ function,command,variable,option or symbol." ms1)))))) (insert ".")) nil) (checkdoc-create-error - (format + (format-message "Argument ‘%s’ should appear (as %s) in the doc string" (car args) (upcase (car args))) s (marker-position e))) @@ -1824,16 +1824,16 @@ Replace with \"%s\"? " original replace) (setq found (intern-soft ms)) (or (boundp found) (fboundp found))) (progn - (setq msg (format "Add quotes around Lisp symbol ‘%s’? " - ms)) + (setq msg (format-message + "Add quotes around Lisp symbol ‘%s’? " ms)) (if (checkdoc-autofix-ask-replace (match-beginning 1) (+ (match-beginning 1) (length ms)) msg (concat "‘" ms "’") t) (setq msg nil) (setq msg - (format "Lisp symbol ‘%s’ should appear in quotes" - ms)))))) + (format-message + "Lisp symbol ‘%s’ should appear in quotes" ms)))))) (if msg (checkdoc-create-error msg (match-beginning 1) (+ (match-beginning 1) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index ea77c92..06e75b3 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2101,8 +2101,8 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...). macroexpand-all-environment)))) (if (or (null (cdar bindings)) (cl-cddar bindings)) (macroexp--warn-and-return - (format "Malformed ‘cl-symbol-macrolet’ binding: %S" - (car bindings)) + (format-message "Malformed ‘cl-symbol-macrolet’ binding: %S" + (car bindings)) expansion) expansion))) (fset 'macroexpand previous-macroexpand)))))) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index d7e3903..7cc789f 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -3373,7 +3373,7 @@ Return the result of the last expression." (defalias 'edebug-prin1 'prin1) (defalias 'edebug-print 'print) (defalias 'edebug-prin1-to-string 'prin1-to-string) -(defalias 'edebug-format 'format) +(defalias 'edebug-format 'format-message) (defalias 'edebug-message 'message) (defun edebug-eval-expression (expr) diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 2ecf412..3b07c5d 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -733,7 +733,7 @@ Argument FN is the function calling this verifier." ((and (or `',name (and name (pred keywordp))) (guard (not (memq name eieio--known-slot-names)))) (macroexp--warn-and-return - (format "Unknown slot ‘%S’" name) exp 'compile-only)) + (format-message "Unknown slot ‘%S’" name) exp 'compile-only)) (_ exp))))) (cl-check-type slot symbol) (cl-check-type obj (or eieio-object class)) diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 032cdec..feffd54 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -261,7 +261,7 @@ Otherwise work like `message'." mode-line-format))) (setq eldoc-mode-line-string (when (stringp format-string) - (apply 'format format-string args))) + (apply #'format-message format-string args))) (force-mode-line-update))) (apply 'message format-string args))) @@ -274,7 +274,7 @@ Otherwise work like `message'." ;; eldoc-last-message so eq test above might succeed on ;; subsequent calls. ((null (cdr args)) (car args)) - (t (apply 'format args)))) + (t (apply #'format-message args)))) ;; In emacs 19.29 and later, and XEmacs 19.13 and later, all messages ;; are recorded in a log. Do not put eldoc messages in that log since ;; they are Legion. diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el index 3365a85..8c67d8c 100644 --- a/lisp/emacs-lisp/elint.el +++ b/lisp/emacs-lisp/elint.el @@ -249,9 +249,9 @@ This environment can be passed to `macroexpand'." (elint-set-mode-line t) (with-current-buffer elint-log-buffer (unless (string-equal default-directory dir) - (elint-log-message (format " \nLeaving directory ‘%s’" - default-directory) t) - (elint-log-message (format "Entering directory ‘%s’" dir) t) + (elint-log-message (format-message " \nLeaving directory ‘%s’" + default-directory) t) + (elint-log-message (format-message "Entering directory ‘%s’" dir) t) (setq default-directory dir)))) (let ((str (format "Linting file %s" file))) (message "%s..." str) @@ -982,7 +982,7 @@ Does basic handling of `featurep' tests." (line-beginning-position)))) 0) ; unknown position type - (apply 'format string args)))) + (apply #'format-message string args)))) (defun elint-error (string &rest args) "Report a linting error. diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 3b103e0..86a1f28 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -367,10 +367,11 @@ message about the whole chain of aliases." (not verbose) (setq aliases (if aliases (concat aliases - (format ", which is an alias for ‘%s’" - (symbol-name def))) - (format "‘%s’ is an alias for ‘%s’" - function (symbol-name def))))) + (format-message + ", which is an alias for ‘%s’" + (symbol-name def))) + (format-message "‘%s’ is an alias for ‘%s’" + function (symbol-name def))))) (setq function (find-function-advised-original function) def (find-function-advised-original function))) (if aliases diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index cc461c8..ff359e6 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -146,11 +146,12 @@ and also to avoid outputting the warning during normal execution." (defun macroexp--obsolete-warning (fun obsolescence-data type) (let ((instead (car obsolescence-data)) (asof (nth 2 obsolescence-data))) - (format "‘%s’ is an obsolete %s%s%s" fun type - (if asof (concat " (as of " asof ")") "") - (cond ((stringp instead) (concat "; " instead)) - (instead (format "; use ‘%s’ instead." instead)) - (t "."))))) + (format-message + "‘%s’ is an obsolete %s%s%s" fun type + (if asof (concat " (as of " asof ")") "") + (cond ((stringp instead) (concat "; " instead)) + (instead (format-message "; use ‘%s’ instead." instead)) + (t "."))))) (defun macroexpand-1 (form &optional environment) "Perform (at most) one step of macroexpansion." diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el index ceae99b..3ac7094 100644 --- a/lisp/emacs-lisp/map-ynp.el +++ b/lisp/emacs-lisp/map-ynp.el @@ -198,7 +198,8 @@ Returns the number of actions taken." (objects (if help (nth 1 help) "objects")) (action (if help (nth 2 help) "act on"))) (concat - (format "Type SPC or ‘y’ to %s the current %s; + (format-message "\ +Type SPC or ‘y’ to %s the current %s; DEL or ‘n’ to skip the current %s; RET or ‘q’ to give up on the %s (skip all remaining %s); C-g to quit (cancel the whole command); diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index 4d5b0c7..7eebb5e 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -95,7 +95,7 @@ Each element has the form (WHERE BYTECODE STACK) where: (propertize (format "%s advice: " where) 'face 'warning) (let ((fun (advice--car flist))) - (if (symbolp fun) (format "‘%S’" fun) + (if (symbolp fun) (format-message "‘%S’" fun) (let* ((name (cdr (assq 'name (advice--props flist)))) (doc (documentation fun t)) (usage (help-split-fundoc doc function))) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 3d2dbdf..7c4f21f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1592,11 +1592,12 @@ SEEN is used internally to detect infinite recursion." (unless problem (setq problem (if (stringp disabled) - (format "Package ‘%s’ held at version %s, but version %s required" - next-pkg disabled - (package-version-join next-version)) - (format "Required package ‘%s’ is disabled" - next-pkg))))) + (format-message + "Package ‘%s’ held at version %s, but version %s required" + next-pkg disabled + (package-version-join next-version)) + (format-message "Required package ‘%s’ is disabled" + next-pkg))))) (t (setq found pkg-desc))))) (unless found (cond @@ -2365,16 +2366,16 @@ Otherwise no newline is inserted." (defun package-install-button-action (button) (let ((pkg-desc (button-get button 'package-desc))) - (when (y-or-n-p (format "Install package ‘%s’? " - (package-desc-full-name pkg-desc))) + (when (y-or-n-p (format-message "Install package ‘%s’? " + (package-desc-full-name pkg-desc))) (package-install pkg-desc nil) (revert-buffer nil t) (goto-char (point-min))))) (defun package-delete-button-action (button) (let ((pkg-desc (button-get button 'package-desc))) - (when (y-or-n-p (format "Delete package ‘%s’? " - (package-desc-full-name pkg-desc))) + (when (y-or-n-p (format-message "Delete package ‘%s’? " + (package-desc-full-name pkg-desc))) (package-delete pkg-desc) (revert-buffer nil t) (goto-char (point-min))))) @@ -3077,8 +3078,8 @@ prompt (see `package-menu--prompt-transaction-p')." (length packages) (mapconcat #'package-desc-full-name packages ", "))) ;; Exactly 1 - (t (format "package ‘%s’" - (package-desc-full-name (car packages)))))) + (t (format-message "package ‘%s’" + (package-desc-full-name (car packages)))))) (defun package-menu--prompt-transaction-p (delete install upgrade) "Prompt the user about DELETE, INSTALL, and UPGRADE. diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index dadbe5f..0a0296f 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -324,7 +324,8 @@ This function is called, by name, directly by the C code." (apply (timer--function timer) (timer--args timer))) (error (message "Error running timer%s: %S" (if (symbolp (timer--function timer)) - (format " ‘%s’" (timer--function timer)) "") + (format-message " ‘%s’" (timer--function timer)) + "") err))) (when (and retrigger ;; If the timer's been canceled, don't "retrigger" it diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el index 44a9876..d729a9a 100644 --- a/lisp/emacs-lisp/warnings.el +++ b/lisp/emacs-lisp/warnings.el @@ -316,7 +316,7 @@ See also `warning-series', `warning-prefix-function' and (defun lwarn (type level message &rest args) "Display a warning message made from (format MESSAGE ARGS...). \\ -Aside from generating the message with `format', +Aside from generating the message with `format-message', this is equivalent to `display-warning'. TYPE is the warning type: either a custom group name (a symbol), @@ -332,15 +332,15 @@ LEVEL should be either :debug, :warning, :error, or :emergency :error -- invalid data or circumstances. :warning -- suspicious data or circumstances. :debug -- info for debugging only." - (display-warning type (apply 'format message args) level)) + (display-warning type (apply #'format-message message args) level)) ;;;###autoload (defun warn (message &rest args) "Display a warning message made from (format MESSAGE ARGS...). -Aside from generating the message with `format', +Aside from generating the message with `format-message', this is equivalent to `display-warning', using `emacs' as the type and `:warning' as the level." - (display-warning 'emacs (apply 'format message args))) + (display-warning 'emacs (apply #'format-message message args))) (provide 'warnings) diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 40a37c7..14f424e 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -3447,8 +3447,8 @@ controlled by the sign of prefix numeric value." (interactive) (setq viper-parse-sexp-ignore-comments (not viper-parse-sexp-ignore-comments)) - (princ (format - "From now on, `%%' will %signore parentheses inside comment fields" + (princ (format-message + "From now on, ‘%%’ will %signore parentheses inside comment fields" (if viper-parse-sexp-ignore-comments "" "NOT ")))) @@ -3986,8 +3986,8 @@ Null string will repeat previous search." (if (null buffer) (error "`%s': No such buffer" buffer-name)) (if (or (not (buffer-modified-p buffer)) (y-or-n-p - (format - "Buffer `%s' is modified, are you sure you want to kill it? " + (format-message + "Buffer ‘%s’ is modified, are you sure you want to kill it? " buffer-name))) (kill-buffer buffer) (error "Buffer not killed")))) @@ -4636,8 +4636,8 @@ One can use \\=`\\=` and '' to temporarily jump 1 step back." (substring text 0 (- pos s)) reg (substring text (- pos s))))) (princ - (format - "Textmarker `%c' is in buffer `%s' at line %d.\n" + (format-message + "Textmarker ‘%c’ is in buffer ‘%s’ at line %d.\n" reg (buffer-name buf) line-no)) (princ (format "Here is some text around %c:\n\n %s" reg text))) diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el index 89bc77f..e856832 100644 --- a/lisp/emulation/viper-macs.el +++ b/lisp/emulation/viper-macs.el @@ -369,12 +369,12 @@ If SCOPE is nil, the user is asked to specify the scope." (setq scope (cond ((y-or-n-p - (format - "Map this macro for buffer `%s' only? " + (format-message + "Map this macro for buffer ‘%s’ only? " (buffer-name))) (setq msg - (format - "%S is mapped to %s for %s in `%s'" + (format-message + "%S is mapped to %s for %s in ‘%s’" (viper-display-macro macro-name) (viper-abbreviate-string (format @@ -385,12 +385,12 @@ If SCOPE is nil, the user is asked to specify the scope." state-name (buffer-name))) (buffer-name)) ((y-or-n-p - (format - "Map this macro for the major mode `%S' only? " + (format-message + "Map this macro for the major mode ‘%S’ only? " major-mode)) (setq msg - (format - "%S is mapped to %s for %s in `%S'" + (format-message + "%S is mapped to %s for %s in ‘%S’" (viper-display-macro macro-name) (viper-abbreviate-string (format diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 6c847f0..a90794f 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -797,7 +797,7 @@ This is called whenever you create a new face, and at other times." symbol (intern name))) (setq menu 'facemenu-face-menu) (setq docstring - (purecopy (format "Select face ‘%s’ for subsequent insertion. + (purecopy (format-message "Select face ‘%s’ for subsequent insertion. If the mark is active and there is no prefix argument, apply face ‘%s’ to the region instead. This command was defined by ‘facemenu-add-new-face’." diff --git a/lisp/faces.el b/lisp/faces.el index e628ee7..9e879c1 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -574,7 +574,7 @@ If FACE is a face-alias, get the documentation for the target face." (let ((alias (get face 'face-alias))) (if alias (let ((doc (get alias 'face-documentation))) - (format "%s is an alias for the face ‘%s’.%s" face alias + (format-message "%s is an alias for the face ‘%s’.%s" face alias (if doc (format "\n%s" doc) ""))) (get face 'face-documentation)))) @@ -1005,7 +1005,7 @@ a single face name." (setq default (car (split-string default crm-separator t)))) (let ((prompt (if default - (format "%s (default ‘%s’): " prompt default) + (format-message "%s (default ‘%s’): " prompt default) (format "%s: " prompt))) aliasfaces nonaliasfaces faces) ;; Build up the completion tables. @@ -1136,10 +1136,10 @@ Value is the new attribute value." (setq name (concat (upcase (substring name 0 1)) (substring name 1))) (let* ((completion-ignore-case t) (value (completing-read - (if default - (format "%s for face ‘%s’ (default %s): " - name face default) - (format "%s for face ‘%s’: " name face)) + (format-message (if default + "%s for face ‘%s’ (default %s): " + "%s for face ‘%s’: ") + name face default) completion-alist nil nil nil nil default))) (if (equal value "") default value))) @@ -1224,8 +1224,8 @@ of a global face. Value is the new attribute value." "Read the name of a font for FACE on FRAME. If optional argument FRAME is nil or omitted, use the selected frame." (let ((completion-ignore-case t)) - (completing-read (format "Set font attributes of face ‘%s’ from font: " - face) + (completing-read (format-message + "Set font attributes of face ‘%s’ from font: " face) (append (fontset-list) (x-list-fonts "*" nil frame))))) @@ -1436,17 +1436,17 @@ If FRAME is omitted or nil, use the selected frame." (when alias (setq face alias) (insert - (format (substitute-command-keys - "\n %s is an alias for the face ‘%s’.\n%s") - f alias - (if (setq obsolete (get f 'obsolete-face)) - (format (substitute-command-keys - " This face is obsolete%s; use ‘%s’ instead.\n") - (if (stringp obsolete) - (format " since %s" obsolete) - "") - alias) - "")))) + (format-message + "\n %s is an alias for the face ‘%s’.\n%s" + f alias + (if (setq obsolete (get f 'obsolete-face)) + (format-message + " This face is obsolete%s; use ‘%s’ instead.\n" + (if (stringp obsolete) + (format " since %s" obsolete) + "") + alias) + "")))) (insert "\nDocumentation:\n" (substitute-command-keys (or (face-documentation face) diff --git a/lisp/files.el b/lisp/files.el index 1039267..f96ac09 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1641,8 +1641,8 @@ killed." (user-error "Aborted")) (and (buffer-modified-p) buffer-file-name (not (yes-or-no-p - (format "Kill and replace buffer ‘%s’ without saving it? " - (buffer-name)))) + (format-message "Kill and replace buffer ‘%s’ without saving it? " + (buffer-name)))) (user-error "Aborted")) (let ((obuf (current-buffer)) (ofile buffer-file-name) @@ -3419,9 +3419,10 @@ local variables, but directory-local variables may still be applied." (setq hack-local-variables--warned-lexical t) (display-warning :warning - (format "%s: ‘lexical-binding’ at end of file unreliable" - (file-name-nondirectory - (or buffer-file-name "")))))) + (format-message + "%s: ‘lexical-binding’ at end of file unreliable" + (file-name-nondirectory + (or buffer-file-name "")))))) (t (ignore-errors (push (cons (if (eq var 'eval) @@ -3556,7 +3557,7 @@ It is dangerous if either of these conditions are met: var (if since (format " (since %s)" since)) (if (stringp instead) (substitute-command-keys instead) - (format "use ‘%s’ instead" instead))))))) + (format-message "use ‘%s’ instead" instead))))))) (defun hack-one-local-variable (var val) "Set local variable VAR with value VAL. @@ -4028,7 +4029,8 @@ Interactively, confirmation is required unless you supply a prefix argument." (not (and (eq (framep-on-display) 'ns) (listp last-nonmenu-event) use-dialog-box)) - (or (y-or-n-p (format "File ‘%s’ exists; overwrite? " filename)) + (or (y-or-n-p (format-message + "File ‘%s’ exists; overwrite? " filename)) (user-error "Canceled"))) (set-visited-file-name filename (not confirm)))) (set-buffer-modified-p t) @@ -4733,8 +4735,9 @@ Before and after saving the buffer, this function runs ;; Signal an error if the user specified the name of an ;; existing directory. (error "%s is a directory" filename) - (unless (y-or-n-p (format "File ‘%s’ exists; overwrite? " - filename)) + (unless (y-or-n-p (format-message + "File ‘%s’ exists; overwrite? " + filename)) (error "Canceled")))) (set-visited-file-name filename))) (or (verify-visited-file-modtime (current-buffer)) @@ -4774,7 +4777,8 @@ Before and after saving the buffer, this function runs (expand-file-name buffer-file-name)))) (unless (file-exists-p dir) (if (y-or-n-p - (format "Directory ‘%s’ does not exist; create? " dir)) + (format-message + "Directory ‘%s’ does not exist; create? " dir)) (make-directory dir t) (error "Canceled"))) (setq setmodes (basic-save-buffer-1)))) @@ -5217,8 +5221,8 @@ given. With a prefix argument, TRASH is nil." (list dir (if (directory-files dir nil directory-files-no-dot-files-regexp) (y-or-n-p - (format "Directory ‘%s’ is not empty, really %s? " - dir (if trashing "trash" "delete"))) + (format-message "Directory ‘%s’ is not empty, really %s? " + dir (if trashing "trash" "delete"))) nil) (null current-prefix-arg)))) ;; If default-directory is a remote directory, make sure we find its diff --git a/lisp/format.el b/lisp/format.el index afec51c..7ab68c8 100644 --- a/lisp/format.el +++ b/lisp/format.el @@ -395,8 +395,8 @@ unless you supply a prefix argument." (cdr (assq 'default-directory (buffer-local-variables))) nil nil (buffer-name)))) - (fmt (format-read (format "Write file ‘%s’ in format: " - (file-name-nondirectory file))))) + (fmt (format-read (format-message "Write file ‘%s’ in format: " + (file-name-nondirectory file))))) (list file fmt (not current-prefix-arg)))) (let ((old-formats buffer-file-format) preserve-formats) @@ -416,8 +416,8 @@ If FORMAT is nil then do not do any format conversion." (interactive ;; Same interactive spec as write-file, plus format question. (let* ((file (read-file-name "Find file: ")) - (fmt (format-read (format "Read file ‘%s’ in format: " - (file-name-nondirectory file))))) + (fmt (format-read (format-message "Read file ‘%s’ in format: " + (file-name-nondirectory file))))) (list file fmt))) (let ((format-alist nil)) (find-file filename)) @@ -435,8 +435,8 @@ a list (ABSOLUTE-FILE-NAME SIZE)." (interactive ;; Same interactive spec as write-file, plus format question. (let* ((file (read-file-name "Find file: ")) - (fmt (format-read (format "Read file ‘%s’ in format: " - (file-name-nondirectory file))))) + (fmt (format-read (format-message "Read file ‘%s’ in format: " + (file-name-nondirectory file))))) (list file fmt))) (let (value size old-undo) ;; Record only one undo entry for the insertion. Inhibit point-motion and diff --git a/lisp/help-fns.el b/lisp/help-fns.el index afd09ca..6ff30b3 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -319,9 +319,7 @@ suitable file is found, return nil." (when remapped (princ "Its keys are remapped to ") (princ (if (symbolp remapped) - (concat (substitute-command-keys "‘") - (symbol-name remapped) - (substitute-command-keys "’")) + (format-message "‘%s’" remapped) "an anonymous command")) (princ ".\n")) @@ -355,7 +353,7 @@ suitable file is found, return nil." (insert "\nThis function has a compiler macro") (if (symbolp handler) (progn - (insert (format (substitute-command-keys " ‘%s’") handler)) + (insert (format-message " ‘%s’" handler)) (save-excursion (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’") nil t) @@ -363,7 +361,7 @@ suitable file is found, return nil." ;; FIXME: Obsolete since 24.4. (let ((lib (get function 'compiler-macro-file))) (when (stringp lib) - (insert (format (substitute-command-keys " in ‘%s’") lib)) + (insert (format-message " in ‘%s’" lib)) (save-excursion (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’") nil t) @@ -443,9 +441,7 @@ suitable file is found, return nil." (when (nth 2 obsolete) (insert (format " since %s" (nth 2 obsolete)))) (insert (cond ((stringp use) (concat ";\n" use)) - (use (format (substitute-command-keys - ";\nuse ‘%s’ instead.") - use)) + (use (format-message ";\nuse ‘%s’ instead." use)) (t ".")) "\n")))) @@ -481,9 +477,8 @@ FILE is the file where FUNCTION was probably defined." (format ";\nin Lisp code %s" interactive-only)) ((and (symbolp 'interactive-only) (not (eq interactive-only t))) - (format (substitute-command-keys - ";\nin Lisp code use ‘%s’ instead.") - interactive-only)) + (format-message ";\nin Lisp code use ‘%s’ instead." + interactive-only)) (t ".")) "\n"))))) @@ -551,8 +546,7 @@ FILE is the file where FUNCTION was probably defined." ;; Aliases are Lisp functions, so we need to check ;; aliases before functions. (aliased - (format (substitute-command-keys "an alias for ‘%s’") - real-def)) + (format-message "an alias for ‘%s’" real-def)) ((autoloadp def) (format "%s autoloaded %s" (if (commandp def) "an interactive" "an") @@ -592,13 +586,12 @@ FILE is the file where FUNCTION was probably defined." (help-xref-button 1 'help-function real-def))))) (when file-name - (princ (substitute-command-keys " in ‘")) ;; We used to add .el to the file name, ;; but that's completely wrong when the user used load-file. - (princ (if (eq file-name 'C-source) - "C source code" - (help-fns-short-filename file-name))) - (princ (substitute-command-keys "’")) + (princ (format-message " in ‘%s’" + (if (eq file-name 'C-source) + "C source code" + (help-fns-short-filename file-name)))) ;; Make a hyperlink to the library. (with-current-buffer standard-output (save-excursion @@ -736,12 +729,11 @@ it is displayed along with the global value." (if file-name (progn - (princ (substitute-command-keys - " is a variable defined in ‘")) - (princ (if (eq file-name 'C-source) - "C source code" - (file-name-nondirectory file-name))) - (princ (substitute-command-keys "’.\n")) + (princ (format-message + " is a variable defined in ‘%s’.\n" + (if (eq file-name 'C-source) + "C source code" + (file-name-nondirectory file-name)))) (with-current-buffer standard-output (save-excursion (re-search-backward (substitute-command-keys @@ -876,9 +868,9 @@ if it is given a local binding.\n"))) ;; Mention if it's an alias. (unless (eq alias variable) (setq extra-line t) - (princ (format (substitute-command-keys - " This variable is an alias for ‘%s’.\n") - alias))) + (princ (format-message + " This variable is an alias for ‘%s’.\n" + alias))) (when obsolete (setq extra-line t) @@ -886,9 +878,8 @@ if it is given a local binding.\n"))) (if (nth 2 obsolete) (princ (format " since %s" (nth 2 obsolete)))) (princ (cond ((stringp use) (concat ";\n " use)) - (use (format (substitute-command-keys - ";\n use ‘%s’ instead.") - (car obsolete))) + (use (format-message ";\n use ‘%s’ instead." + (car obsolete))) (t "."))) (terpri)) @@ -950,8 +941,7 @@ file-local variable.\n") (princ "if its value\n satisfies the predicate ") (princ (if (byte-code-function-p safe-var) "which is a byte-compiled expression.\n" - (format (substitute-command-keys "‘%s’.\n") - safe-var)))) + (format-message "‘%s’.\n" safe-var)))) (if extra-line (terpri)) (princ "Documentation:\n") diff --git a/lisp/help.el b/lisp/help.el index db87d58..2fcb52e 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -964,9 +964,8 @@ documentation for the major and minor modes of that buffer." (let* ((mode major-mode) (file-name (find-lisp-object-file-name mode nil))) (when file-name - (princ (concat (substitute-command-keys " defined in ‘") - (file-name-nondirectory file-name) - (substitute-command-keys "’"))) + (princ (format-message " defined in ‘%s’" + (file-name-nondirectory file-name))) ;; Make a hyperlink to the library. (with-current-buffer standard-output (save-excursion diff --git a/lisp/info-xref.el b/lisp/info-xref.el index 3e871a1..2b81efa 100644 --- a/lisp/info-xref.el +++ b/lisp/info-xref.el @@ -170,13 +170,13 @@ overall good/bad count summary inserted at the very end." info-xref-good info-xref-bad info-xref-unavail)))) (defun info-xref-output (fmt &rest args) - "Emit a `format'-ed message FMT+ARGS to the `info-xref-output-buffer'." + "Emit a `format-message'-ed message FMT+ARGS to the `info-xref-output-buffer'." (with-current-buffer info-xref-output-buffer (save-excursion (goto-char (point-max)) (let ((inhibit-read-only t)) (insert info-xref-output-heading - (apply 'format fmt args) + (apply #'format-message fmt args) "\n"))) (setq info-xref-output-heading "") ;; all this info-xref can be pretty slow, display now so the user sees diff --git a/lisp/info.el b/lisp/info.el index 454fada..74ca947 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -3460,7 +3460,7 @@ MATCHES is a list of index matches found by `Info-index'.") (when (equal (car (nth 0 nodeinfo)) (or filename Info-current-file)) (insert (format "* %-20s %s.\n" - (format "*Index for ‘%s’*::" (cdr (nth 0 nodeinfo))) + (format-message "*Index for ‘%s’*::" (cdr (nth 0 nodeinfo))) (cdr (nth 0 nodeinfo))))))))) (defun Info-virtual-index (topic) @@ -3495,7 +3495,8 @@ search results." (setq Info-history-list ohist-list) (Info-goto-node orignode) (message ""))) - (Info-find-node Info-current-file (format "*Index for ‘%s’*" topic)))) + (Info-find-node Info-current-file + (format-message "*Index for ‘%s’*" topic)))) (add-to-list 'Info-virtual-files '("\\`\\*Apropos\\*\\'" @@ -3634,7 +3635,7 @@ Build a menu of the possible matches." (setq nodes (cdr nodes))) (if nodes (Info-find-node Info-apropos-file (car (car nodes))) - (setq nodename (format "Index for ‘%s’" string)) + (setq nodename (format-message "Index for ‘%s’" string)) (push (list nodename string (Info-apropos-matches string)) Info-apropos-nodes) (Info-find-node Info-apropos-file nodename))))) diff --git a/lisp/international/kkc.el b/lisp/international/kkc.el index 90fb151..7eb8a4d 100644 --- a/lisp/international/kkc.el +++ b/lisp/international/kkc.el @@ -209,7 +209,7 @@ area while indicating the current selection by `'." (define-error 'kkc-error nil) (defun kkc-error (&rest args) - (signal 'kkc-error (apply 'format args))) + (signal 'kkc-error (apply #'format-message args))) (defvar kkc-converting nil) diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 2142f0b..16666ac 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -719,14 +719,14 @@ DEFAULT is the coding system to use by default in the query." (insert "No default coding systems to try for " (if (stringp from) (format "string \"%s\"." from) - (format "buffer ‘%s’." bufname))) + (format-message "buffer ‘%s’." bufname))) (insert "These default coding systems were tried to encode" (if (stringp from) (concat " \"" (if (> (length from) 10) (concat (substring from 0 10) "...\"") (concat from "\""))) - (format " text\nin the buffer ‘%s’" bufname)) + (format-message " text\nin the buffer ‘%s’" bufname)) ":\n") (let ((pos (point)) (fill-prefix " ")) @@ -881,7 +881,7 @@ for the current buffer/file by the %s. It is highly recommended to fix it before writing to a file." (car auto-cs) (if (eq (cdr auto-cs) :coding) ":coding tag" - (format "variable ‘%s’" (cdr auto-cs)))) + (format-message "variable ‘%s’" (cdr auto-cs)))) :warning) (or (yes-or-no-p "Really proceed with writing? ") (error "Save aborted")) @@ -1587,7 +1587,7 @@ which marks the variable `default-input-method' as set for Custom buffers." (called-interactively-p 'interactive)) (with-output-to-temp-buffer (help-buffer) (let ((elt (assoc input-method input-method-alist))) - (princ (format + (princ (format-message "Input method: %s (‘%s’ in mode line) for %s\n %s\n" input-method (nth 3 elt) (nth 1 elt) (nth 4 elt)))))))))) diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el index c3d58aa..063b873 100644 --- a/lisp/international/mule-conf.el +++ b/lisp/international/mule-conf.el @@ -904,8 +904,9 @@ (dolist (script '(devanagari sanskrit bengali tamil telugu assamese oriya kannada malayalam gujarati punjabi)) (define-charset (intern (format "%s-cdac" script)) - (format "Glyphs of %s script for CDAC font. Subset of ‘indian-glyph’." - (capitalize (symbol-name script))) + (format-message + "Glyphs of %s script for CDAC font. Subset of ‘indian-glyph’." + (capitalize (symbol-name script))) :short-name (format "CDAC %s glyphs" (capitalize (symbol-name script))) :supplementary-p t :code-space [0 255] @@ -915,8 +916,9 @@ (dolist (script '(devanagari bengali punjabi gujarati oriya tamil telugu kannada malayalam)) (define-charset (intern (format "%s-akruti" script)) - (format "Glyphs of %s script for AKRUTI font. Subset of ‘indian-glyph’." - (capitalize (symbol-name script))) + (format-message + "Glyphs of %s script for AKRUTI font. Subset of ‘indian-glyph’." + (capitalize (symbol-name script))) :short-name (format "AKRUTI %s glyphs" (capitalize (symbol-name script))) :supplementary-p t :code-space [0 255] diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 7ef758b..57b6d62 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -332,7 +332,7 @@ meanings of these arguments." (let ((char (charset-iso-final-char charset))) (when (> char 0) (insert "Final char of ISO2022 designation sequence: ") - (insert (format "‘%c’\n" char)))) + (insert (format-message "‘%c’\n" char)))) (let (aliases) (dolist (c charset-list) (if (and (not (eq c charset)) @@ -1058,17 +1058,18 @@ installed LEIM (Libraries of Emacs Input Methods).") (setq language (nth 1 elt)) (princ language) (terpri)) - (princ (format " %s (‘%s’ in mode line)\n %s\n" - (car elt) - (let ((title (nth 3 elt))) - (if (and (consp title) (stringp (car title))) - (car title) - title)) - ;; If the doc is multi-line, indent all - ;; non-blank lines. (Bug#8066) - (replace-regexp-in-string - "\n\\(.\\)" "\n \\1" - (substitute-command-keys (or (nth 4 elt) ""))))))))) + (princ (format-message + " %s (‘%s’ in mode line)\n %s\n" + (car elt) + (let ((title (nth 3 elt))) + (if (and (consp title) (stringp (car title))) + (car title) + title)) + ;; If the doc is multi-line, indent all + ;; non-blank lines. (Bug#8066) + (replace-regexp-in-string + "\n\\(.\\)" "\n \\1" + (substitute-command-keys (or (nth 4 elt) ""))))))))) ;;; DIAGNOSIS diff --git a/lisp/international/quail.el b/lisp/international/quail.el index f60af4a..8c9d145 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -1305,7 +1305,7 @@ The returned value is a Quail map specific to KEY." (define-error 'quail-error nil) (defun quail-error (&rest args) - (signal 'quail-error (apply 'format args))) + (signal 'quail-error (apply #'format-message args))) (defun quail-input-string-to-events (str) "Convert input string STR to a list of events. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 411416b..689911c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -687,7 +687,7 @@ for use at QPOS." The text is displayed for `minibuffer-message-timeout' seconds, or until the next input event arrives, whichever comes first. Enclose MESSAGE in [...] if this is not yet the case. -If ARGS are provided, then pass MESSAGE through `format'." +If ARGS are provided, then pass MESSAGE through `format-message'." (if (not (minibufferp (current-buffer))) (progn (if args @@ -702,7 +702,7 @@ If ARGS are provided, then pass MESSAGE through `format'." ;; Make sure we can put-text-property. (copy-sequence message) (concat " [" message "]"))) - (when args (setq message (apply 'format message args))) + (when args (setq message (apply #'format-message message args))) (let ((ol (make-overlay (point-max) (point-max) nil t t)) ;; A quit during sit-for normally only interrupts the sit-for, ;; but since minibuffer-message is used at the end of a command, diff --git a/lisp/mpc.el b/lisp/mpc.el index 76c08db..fb59adf 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -217,7 +217,7 @@ defaults to 6600 and HOST defaults to localhost." (goto-char (point-max)) (insert-before-markers ;So it scrolls. (replace-regexp-in-string "\n" "\n " - (apply 'format format args)) + (apply #'format-message format args)) "\n")))) (defun mpc--proc-filter (proc string) @@ -1643,7 +1643,7 @@ Return non-nil if a selection was deactivated." (when (equal (sort (copy-sequence active) #'string-lessp) (sort (copy-sequence selection) #'string-lessp)) (setq active 'all))) - + ;; FIXME: This `mpc-sort' takes a lot of time. Maybe we should ;; be more clever and presume the buffer is mostly sorted already. (mpc-sort (if (listp active) active)) diff --git a/lisp/msb.el b/lisp/msb.el index 149d193..03b2920 100644 --- a/lisp/msb.el +++ b/lisp/msb.el @@ -745,8 +745,8 @@ to the buffer-list variable in FUNCTION-INFO." (msb--add-to-menu buffer info max-buffer-name-length))) (error (unless msb--error (setq msb--error - (format - "In msb-menu-cond, error for buffer `%s'." + (format-message + "In msb-menu-cond, error for buffer ‘%s’." (buffer-name buffer))) (error "%s" msb--error)))))) diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 0685bac..62ee316 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -1107,7 +1107,7 @@ All HOST values should be in lower case.") (defun ange-ftp-message (fmt &rest args) "Display message in echo area, but indicate if truncated. Args are as in `message': a format string, plus arguments to be formatted." - (let ((msg (apply 'format fmt args)) + (let ((msg (apply #'format-message fmt args)) (max (window-width (minibuffer-window)))) (if noninteractive msg diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index 235b2a2..418796a 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el @@ -259,7 +259,7 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." (message "%s: (err=[%s] %s) %s" "gnutls.el" doit (gnutls-error-string doit) - (apply 'format format (or params '(nil)))))) + (apply #'format-message format (or params '(nil)))))) (provide 'gnutls) diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 435851c..0175548 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -846,10 +846,10 @@ Argument BUFFER is the buffer of the retrieval process." newsticker--cache name-symbol newsticker--error-headline - (format + (format-message (concat "%s: Newsticker could not retrieve news from %s.\n" - "Return status: `%s'\n" - "Command was `%s'") + "Return status: ‘%s’\n" + "Command was ‘%s’") (format-time-string "%A, %H:%M") feed-name event command) "" diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el index eca2a9c..ef8507e 100644 --- a/lisp/net/newst-treeview.el +++ b/lisp/net/newst-treeview.el @@ -1268,8 +1268,8 @@ Note: does not update the layout." (expand-file-name (concat newsticker-dir "/groups")))) (file-exists-p newsticker-groups-filename) (y-or-n-p - (format - (concat "Obsolete variable `newsticker-groups-filename' " + (format-message + (concat "Obsolete variable ‘newsticker-groups-filename’ " "points to existing file \"%s\".\n" "Read it? ") newsticker-groups-filename)) @@ -1279,9 +1279,9 @@ Note: does not update the layout." (find-file-noselect filename)))) (and newsticker-groups-filename (file-exists-p newsticker-groups-filename) - (y-or-n-p (format + (y-or-n-p (format-message (concat "Delete the file \"%s\",\nto which the obsolete " - "variable `newsticker-groups-filename' points ? ") + "variable ‘newsticker-groups-filename’ points ? ") newsticker-groups-filename)) (delete-file newsticker-groups-filename)) (when buf diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el index 261e5a1..c54553a 100644 --- a/lisp/net/nsm.el +++ b/lisp/net/nsm.el @@ -304,7 +304,7 @@ unencrypted." (when (> (length cert) 0) (insert cert "\n")) (let ((start (point))) - (insert (apply 'format message args)) + (insert (apply #'format-message message args)) (goto-char start) ;; Fill the first line of the message, which usually ;; contains lots of explanatory text. diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el index e71179b..c0dcc23 100644 --- a/lisp/net/rlogin.el +++ b/lisp/net/rlogin.el @@ -174,8 +174,8 @@ If you wish to change directory tracking styles during a session, use the function `rlogin-directory-tracking-mode' rather than simply setting the variable." (interactive (list - (read-from-minibuffer (format - "Arguments for `%s' (hostname first): " + (read-from-minibuffer (format-message + "Arguments for ‘%s’ (hostname first): " (file-name-nondirectory rlogin-program)) nil nil nil 'rlogin-history) current-prefix-arg)) diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 3fc6022..a05108d 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -51,7 +51,8 @@ (defsubst soap-warning (message &rest args) "Display a warning MESSAGE with ARGS, using the 'soap-client warning type." - (display-warning 'soap-client (apply 'format message args) :warning)) + (display-warning 'soap-client (apply #'format-message message args) + :warning)) (defgroup soap-client nil "Access SOAP web services from Emacs." diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 193d70b..69d7e1f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1504,7 +1504,7 @@ ARGUMENTS to actually emit the message (if applicable)." ; (1+ (count-lines (point-min) (cdr ffn))))))) (insert (format "%s " fn))) ;; The message. - (insert (apply 'format fmt-string arguments)))) + (insert (apply #'format-message fmt-string arguments)))) (defvar tramp-message-show-message t "Show Tramp message in the minibuffer. @@ -1581,8 +1581,8 @@ signal identifier to be raised, remaining arguments passed to (error-message-string (list signal (get signal 'error-message) - (apply 'format fmt-string arguments))))) - (signal signal (list (apply 'format fmt-string arguments))))) + (apply #'format-message fmt-string arguments))))) + (signal signal (list (apply #'format-message fmt-string arguments))))) (defsubst tramp-error-with-buffer (buf vec-or-proc signal fmt-string &rest arguments) @@ -3599,8 +3599,8 @@ connection buffer." "Tramp failed to connect. If this happens repeatedly, try\n" " `\\[tramp-cleanup-this-connection]'"))) ((eq exit 'timeout) - (format - "Timeout reached, see buffer `%s' for details" + (format-message + "Timeout reached, see buffer ‘%s’ for details" (tramp-get-connection-buffer vec))) (t "Login failed"))))) (when (numberp pos) diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el index a8dc5b1..c87cd53 100644 --- a/lisp/nxml/nxml-outln.el +++ b/lisp/nxml/nxml-outln.el @@ -1003,7 +1003,7 @@ immediately after the section's start-tag." ;;; Error handling (defun nxml-report-outline-error (msg err) - (error msg (apply 'format (cdr err)))) + (error msg (apply #'format-message (cdr err)))) (defun nxml-outline-error (&rest args) (signal 'nxml-outline-error args)) diff --git a/lisp/nxml/nxml-parse.el b/lisp/nxml/nxml-parse.el index c0a8497..d8523ee 100644 --- a/lisp/nxml/nxml-parse.el +++ b/lisp/nxml/nxml-parse.el @@ -304,7 +304,7 @@ same way as well-formedness error." (defun nxml-parse-error (position &rest args) (nxml-signal-file-parse-error nxml-parse-file-name (or position xmltok-start) - (apply 'format args))) + (apply #'format-message args))) (defun nxml-check-xmltok-errors () (when xmltok-errors diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el index 5934031..31864a4 100644 --- a/lisp/nxml/rng-cmpct.el +++ b/lisp/nxml/rng-cmpct.el @@ -400,7 +400,7 @@ OVERRIDE is either nil, require or t." (defun rng-c-error (&rest args) (rng-c-signal-incorrect-schema rng-c-file-name (rng-c-translate-position (point)) - (apply 'format args))) + (apply #'format-message args))) (defun rng-c-parse-top-level (context) (let ((rng-c-namespace-decls nil) diff --git a/lisp/nxml/rng-match.el b/lisp/nxml/rng-match.el index 8ebb573..ef55e85 100644 --- a/lisp/nxml/rng-match.el +++ b/lisp/nxml/rng-match.el @@ -1504,7 +1504,7 @@ nullable and y1 isn't, return a choice (defun rng-compile-error (&rest args) (signal 'rng-compile-error - (list (apply 'format args)))) + (list (apply #'format-message args)))) (define-error 'rng-compile-error "Incorrect schema" 'rng-error) diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el index e95ad08..98b4384 100644 --- a/lisp/nxml/rng-uri.el +++ b/lisp/nxml/rng-uri.el @@ -125,7 +125,7 @@ Signal an error if URI is not a valid file URL." (t path)))) (defun rng-uri-error (&rest args) - (signal 'rng-uri-error (list (apply 'format args)))) + (signal 'rng-uri-error (list (apply #'format-message args)))) (define-error 'rng-uri-error "Invalid URI") diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el index 111de85..e0d78e1 100644 --- a/lisp/obsolete/iswitchb.el +++ b/lisp/obsolete/iswitchb.el @@ -1095,8 +1095,8 @@ Return the modified list with the last element prepended to it." (and iswitchb-prompt-newbuffer (y-or-n-p - (format - "No buffer matching `%s', create one? " + (format-message + "No buffer matching ‘%s’, create one? " buf))))) ;; then create a new buffer (progn diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el index a9baf04..911ee2e 100644 --- a/lisp/org/org-ctags.el +++ b/lisp/org/org-ctags.el @@ -455,8 +455,8 @@ to rebuild (update) the TAGS file." Wrapper for org-ctags-rebuild-tags-file-then-find-tag." (if (and (buffer-file-name) (y-or-n-p - (format - "Tag `%s' not found. Rebuild table `%s/TAGS' and look again?" + (format-message + "Tag ‘%s’ not found. Rebuild table ‘%s/TAGS’ and look again?" name (file-name-directory (buffer-file-name))))) (org-ctags-rebuild-tags-file-then-find-tag name) diff --git a/lisp/proced.el b/lisp/proced.el index 69355ab..922e016 100644 --- a/lisp/proced.el +++ b/lisp/proced.el @@ -1915,7 +1915,7 @@ and \f (formfeed) at the end." (let (buffer-read-only) (cond ((stringp log) (insert (if args - (apply 'format log args) + (apply #'format-message log args) log))) ((bufferp log) (insert-buffer-substring log)) diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index a897f96..c694bbd 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el @@ -6345,7 +6345,7 @@ killed after process termination." (when ebnf-log (with-current-buffer (get-buffer-create "*Ebnf2ps Log*") (goto-char (point-max)) - (insert (apply 'format format-str args) "\n")))) + (insert (apply #'format-message format-str args) "\n")))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index bb5ac63..1942271 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -200,7 +200,7 @@ ignored. Otherwise, it is printed using `message'. TEXT is a format control string, and the remaining arguments ARGS are the string substitutions (see the function `format')." (if (<= level flymake-log-level) - (let* ((msg (apply 'format text args))) + (let* ((msg (apply #'format-message text args))) (message "%s" msg)))) (defun flymake-ins-after (list pos val) diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 451acd2..1b270e6 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -2305,11 +2305,12 @@ Ignore byte-compiler warnings you might see." (defun vhdl-warning-when-idle (&rest args) "Wait until idle, then print out warning STRING and beep." - (if noninteractive - (vhdl-warning (apply 'format args) t) - (unless vhdl-warnings - (vhdl-run-when-idle .1 nil 'vhdl-print-warnings)) - (push (apply 'format args) vhdl-warnings))) + (let ((message (apply #'format-message args))) + (if noninteractive + (vhdl-warning message t) + (unless vhdl-warnings + (vhdl-run-when-idle .1 nil 'vhdl-print-warnings)) + (push message vhdl-warnings)))) (defun vhdl-warning (string &optional nobeep) "Print out warning STRING and beep." diff --git a/lisp/replace.el b/lisp/replace.el index 3cdb54f..26870a3 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1495,7 +1495,8 @@ See also `multi-occur'." ;; Don't display regexp if with remaining text ;; it is longer than window-width. (if (> (+ (length regexp) 42) (window-width)) - "" (format " for ‘%s’" (query-replace-descr regexp))))) + "" (format-message + " for ‘%s’" (query-replace-descr regexp))))) (setq occur-revert-arguments (list regexp nlines bufs)) (if (= count 0) (kill-buffer occur-buf) diff --git a/lisp/simple.el b/lisp/simple.el index ea43975..87d9444 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1689,11 +1689,11 @@ invoking, give a prefix argument to `execute-extended-command'." (symbol-name function) typed)))) (when binding (with-temp-message - (format "You can run the command ‘%s’ with %s" - function - (if (stringp binding) - (concat "M-x " binding " RET") - (key-description binding))) + (format-message "You can run the command ‘%s’ with %s" + function + (if (stringp binding) + (concat "M-x " binding " RET") + (key-description binding))) (sit-for (if (numberp suggest-key-bindings) suggest-key-bindings 2)))))))) @@ -2796,16 +2796,18 @@ This variable only matters if `undo-ask-before-discard' is non-nil.") ;; but we don't want to ask the question again. (setq undo-extra-outer-limit (+ size 50000)) (if (let (use-dialog-box track-mouse executing-kbd-macro ) - (yes-or-no-p (format "Buffer ‘%s’ undo info is %d bytes long; discard it? " - (buffer-name) size))) + (yes-or-no-p (format-message + "Buffer ‘%s’ undo info is %d bytes long; discard it? " + (buffer-name) size))) (progn (setq buffer-undo-list nil) (setq undo-extra-outer-limit nil) t) nil)) (display-warning '(undo discard-info) (concat - (format "Buffer ‘%s’ undo info was %d bytes long.\n" - (buffer-name) size) + (format-message + "Buffer ‘%s’ undo info was %d bytes long.\n" + (buffer-name) size) "The undo info was discarded because it exceeded \ `undo-outer-limit'. @@ -8326,8 +8328,9 @@ contains the list of implementations currently supported for this command." (interactive "P") (when (or arg (null ,varimp-sym)) (let ((val (completing-read - ,(format "Select implementation for command ‘%s’: " - command-name) + ,(format-message + "Select implementation for command ‘%s’: " + command-name) ,varalt-sym nil t))) (unless (string-equal val "") (when (null ,varimp-sym) @@ -8339,8 +8342,9 @@ contains the list of implementations currently supported for this command." (cdr (assoc-string val ,varalt-sym)))))) (if ,varimp-sym (call-interactively ,varimp-sym) - (message ,(format "No implementation selected for command ‘%s’" - command-name))))))) + (message "%s" ,(format-message + "No implementation selected for command ‘%s’" + command-name))))))) diff --git a/lisp/startup.el b/lisp/startup.el index ec159c2..2d1bcc9 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1177,7 +1177,8 @@ please check its value") (error (display-warning 'initialization - (format "An error occurred while loading ‘%s’:\n\n%s%s%s\n\n\ + (format-message "\ +An error occurred while loading ‘%s’:\n\n%s%s%s\n\n\ To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the ‘--debug-init’ option to view a complete error backtrace." @@ -1312,7 +1313,8 @@ the ‘--debug-init’ option to view a complete error backtrace." (expand-file-name user-emacs-directory)) (setq warned t) (display-warning 'initialization - (format "Your ‘load-path’ seems to contain + (format-message "\ +Your ‘load-path’ seems to contain\n\ your ‘.emacs.d’ directory: %s\n\ This is likely to cause problems...\n\ Consider using a subdirectory instead, e.g.: %s" diff --git a/lisp/subr.el b/lisp/subr.el index 7e7dbd1..6d99c6c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -288,6 +288,12 @@ This function accepts any number of arguments, but ignores them." (interactive) nil) +(defun format-message (format-string &rest args) + "Format a string out of FORMAT-STRING and arguments. +This is like ‘format’, except it also converts curved quotes in +FORMAT-STRING as per ‘text-quoting-style’." + (apply #'format (internal--text-restyle format-string) args)) + ;; Signal a compile-error if the first arg is missing. (defun error (&rest args) "Signal an error, making error message by passing all args to `format'. @@ -295,7 +301,7 @@ In Emacs, the convention is that error messages start with a capital letter but *do not* end with a period. Please follow this convention for the sake of consistency." (declare (advertised-calling-convention (string &rest args) "23.1")) - (signal 'error (list (apply 'format args)))) + (signal 'error (list (apply #'format-message args)))) (defun user-error (format &rest args) "Signal a pilot error, making error message by passing all args to `format'. @@ -305,7 +311,7 @@ for the sake of consistency. This is just like `error' except that `user-error's are expected to be the result of an incorrect manipulation on the part of the user, rather than the result of an actual problem." - (signal 'user-error (list (apply #'format format args)))) + (signal 'user-error (list (apply #'format-message format args)))) (defun define-error (name message &optional parent) "Define NAME as a new error signal. @@ -1606,8 +1612,9 @@ can do the job." exp (let* ((sym (cadr list-var)) (append (eval append)) - (msg (format "‘add-to-list’ can't use lexical var ‘%s’; use ‘push’ or ‘cl-pushnew’" - sym)) + (msg (format-message + "‘add-to-list’ can't use lexical var ‘%s’; use ‘push’ or ‘cl-pushnew’" + sym)) ;; Big ugly hack so we only output a warning during ;; byte-compilation, and so we can use ;; byte-compile-not-lexical-var-p to silence the warning diff --git a/lisp/tutorial.el b/lisp/tutorial.el index 9fea316..e9095b3 100644 --- a/lisp/tutorial.el +++ b/lisp/tutorial.el @@ -141,12 +141,13 @@ options: db)) (insert "However, your customizations have " (if cb - (format "rebound it to the command ‘%s’" cb) + (format-message "rebound it to the command ‘%s’" cb) "unbound it")) (insert ".") (when mapsym (insert " (For the more advanced user:" - (format " This binding is in the keymap ‘%s’.)" mapsym))) + (format-message + " This binding is in the keymap ‘%s’.)" mapsym))) (if (string= where "") (unless (keymapp db) (insert "\n\nYou can use M-x " @@ -158,7 +159,7 @@ options: "" "the key") where - (format " to get the function ‘%s’." db)))) + (format-message " to get the function ‘%s’." db)))) (fill-region (point-min) (point))))) (help-print-return-message)))) @@ -450,7 +451,7 @@ where (lookup-key global-map [menu-bar])))) (stringp cwhere)) - (format "the ‘%s’ menu" cwhere) + (format-message "the ‘%s’ menu" cwhere) "the menus")))) (setq where "")) (setq remark nil) diff --git a/src/callint.c b/src/callint.c index 2ff2f80..be0fb1a 100644 --- a/src/callint.c +++ b/src/callint.c @@ -511,6 +511,7 @@ invoke it. If KEYS is omitted or nil, the return value of for (i = 2; *tem; i++) { visargs[1] = make_string (tem + 1, strcspn (tem + 1, "\n")); + visargs[1] = Finternal__text_restyle (visargs[1]); if (strchr (SSDATA (visargs[1]), '%')) callint_message = Fformat (i - 1, visargs + 1); else diff --git a/src/doc.c b/src/doc.c index f871ac7..3c8b11d 100644 --- a/src/doc.c +++ b/src/doc.c @@ -1028,6 +1028,67 @@ Otherwise, return a new string. */) xfree (buf); RETURN_UNGCPRO (tem); } + +DEFUN ("internal--text-restyle", Finternal__text_restyle, + Sinternal__text_restyle, 1, 1, 0, + doc: /* Return STRING, possibly substituting quote characters. + +In the result, replace each curved single quote (\\=‘ and \\=’) by +left and right quote characters as specified by ‘text-quoting-style’. + +Return the original STRING in the common case where no changes are needed. +Otherwise, return a new string. */) + (Lisp_Object string) +{ + bool changed = false; + + CHECK_STRING (string); + if (! STRING_MULTIBYTE (string)) + return string; + + enum text_quoting_style quoting_style = text_quoting_style (); + if (quoting_style == CURVE_QUOTING_STYLE) + return string; + + ptrdiff_t bsize = SBYTES (string); + unsigned char const *strp = SDATA (string); + unsigned char const *strlim = strp + bsize; + USE_SAFE_ALLOCA; + char *buf = SAFE_ALLOCA (bsize); + char *bufp = buf; + ptrdiff_t nchars = 0; + + while (strp < strlim) + { + unsigned char const *cp = strp; + switch (STRING_CHAR_ADVANCE (strp)) + { + case LEFT_SINGLE_QUOTATION_MARK: + *bufp++ = quoting_style == GRAVE_QUOTING_STYLE ? '`': '\''; + changed = true; + break; + + case RIGHT_SINGLE_QUOTATION_MARK: + *bufp++ = '\''; + changed = true; + break; + + default: + do + *bufp++ = *cp++; + while (cp != strp); + + break; + } + + nchars++; + } + + Lisp_Object result + = changed ? make_string_from_bytes (buf, nchars, bufp - buf) : string; + SAFE_FREE (); + return result; +} void syms_of_doc (void) @@ -1061,4 +1122,5 @@ displayable, and like ‘grave’ otherwise. */); defsubr (&Sdocumentation_property); defsubr (&Ssnarf_documentation); defsubr (&Ssubstitute_command_keys); + defsubr (&Sinternal__text_restyle); } diff --git a/src/editfns.c b/src/editfns.c index 8ac0ef1..da7d554 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3696,8 +3696,8 @@ usage: (message FORMAT-STRING &rest ARGS) */) } else { - register Lisp_Object val; - val = Fformat (nargs, args); + args[0] = Finternal__text_restyle (args[0]); + Lisp_Object val = Fformat (nargs, args); message3 (val); return val; } @@ -3722,6 +3722,7 @@ usage: (message-box FORMAT-STRING &rest ARGS) */) } else { + args[0] = Finternal__text_restyle (args[0]); Lisp_Object val = Fformat (nargs, args); Lisp_Object pane, menu; struct gcpro gcpro1; commit a5fd059f726f4de839d33a2813f1c98d62fc6fbe Author: Paul Eggert Date: Sun Aug 23 17:29:09 2015 -0700 * etc/NEWS: The new ‘q’ flag is not an incompatible change. diff --git a/etc/NEWS b/etc/NEWS index d3a01c2..42a5e14 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -910,12 +910,6 @@ denied" instead of "permission denied". The old behavior was problematic in languages like German where downcasing rules depend on grammar. +++ -** New ‘format’ flag ‘q’ -The new ‘q’ flag causes ‘format’ to quote the output representation as -per the value of ‘text quoting-style’. E.g., (format "%qs failed" -"foo") might return "‘foo’ failed". - -+++ ** substitute-command-keys now replaces quotes. That is, it converts documentation strings' quoting style as per the value of ‘text-quoting-style’. Doc strings in source code can use @@ -1045,6 +1039,12 @@ key works) by typing ‘A-[’ and ‘A-]’. As described above under quotes. +++ +** New ‘format’ flag ‘q’ +The new ‘q’ flag causes ‘format’ to quote the output representation as +per the value of ‘text-quoting-style’. E.g., (format "%qs failed" +"foo") might return "‘foo’ failed". + ++++ ** show-help-function's arg is converted via substitute-command-keys before being passed to the function. Help strings, help-echo properties, etc. can therefore contain command key escapes and commit af013e0d4a76f0a2fd4a0e76912e8e49ae86ec2e Author: Fabián Ezequiel Gallina Date: Sun Aug 23 19:55:54 2015 -0300 python.el: Fix python-shell-buffer-substring on indented code Fixes: debbugs:21086 * lisp/progmodes/python.el (python-shell-buffer-substring): Respect current line indentation when calculating string. * test/automated/python-tests.el (python-shell-buffer-substring-10) (python-shell-buffer-substring-11) (python-shell-buffer-substring-12): New tests. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index fbe5b8b..abae8af 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2986,29 +2986,32 @@ the python shell: coding cookie is added. 4. Wraps indented regions under an \"if True:\" block so the interpreter evaluates them correctly." - (let* ((substring (buffer-substring-no-properties start end)) + (let* ((start (save-excursion + ;; Normalize start to the line beginning position. + (goto-char start) + (line-beginning-position))) + (substring (buffer-substring-no-properties start end)) (starts-at-point-min-p (save-restriction (widen) (= (point-min) start))) (encoding (python-info-encoding)) + (toplevel-p (zerop (save-excursion + (goto-char start) + (python-util-forward-comment 1) + (current-indentation)))) (fillstr (when (not starts-at-point-min-p) (concat (format "# -*- coding: %s -*-\n" encoding) (make-string ;; Subtract 2 because of the coding cookie. - (- (line-number-at-pos start) 2) ?\n)))) - (toplevel-block-p (save-excursion - (goto-char start) - (or (zerop (line-number-at-pos start)) - (progn - (python-util-forward-comment 1) - (zerop (current-indentation))))))) + (- (line-number-at-pos start) 2) ?\n))))) (with-temp-buffer (python-mode) - (if fillstr (insert fillstr)) + (when fillstr + (insert fillstr)) (insert substring) (goto-char (point-min)) - (when (not toplevel-block-p) + (when (not toplevel-p) (insert "if True:") (delete-region (point) (line-end-position))) (when nomain diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index e792b0f..30b1b48 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el @@ -3276,6 +3276,61 @@ class Foo(models.Model): ")))) +(ert-deftest python-shell-buffer-substring-10 () + "Check substring from partial block." + (python-tests-with-temp-buffer + " +def foo(): + print ('a') +" + (should (string= (python-shell-buffer-substring + (python-tests-look-at "print ('a')") + (point-max)) + "if True: + + print ('a') +")))) + +(ert-deftest python-shell-buffer-substring-11 () + "Check substring from partial block and point within indentation." + (python-tests-with-temp-buffer + " +def foo(): + print ('a') +" + (should (string= (python-shell-buffer-substring + (progn + (python-tests-look-at "print ('a')") + (backward-char 1) + (point)) + (point-max)) + "if True: + + print ('a') +")))) + +(ert-deftest python-shell-buffer-substring-12 () + "Check substring from partial block and point in whitespace." + (python-tests-with-temp-buffer + " +def foo(): + + # Whitespace + + print ('a') +" + (should (string= (python-shell-buffer-substring + (python-tests-look-at "# Whitespace") + (point-max)) + "if True: + + + # Whitespace + + print ('a') +")))) + + ;;; Shell completion commit 41cb0162c5bcf440dca36afcd493db585e8c4901 Author: Paul Eggert Date: Sun Aug 23 13:50:59 2015 -0700 Fix minor glitches from ‘format’ reversion * doc/lispref/strings.texi (Formatting Strings): After reversion, ‘text-quoting-style’ is documented in ‘Keys in Documentation’, not below. * src/syntax.c (Finternal_describe_syntax_value): Prefer AUTO_STRING to build_string where either will do, as AUTO_STRING is a bit faster. diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 580eb43..c4556cb 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -948,7 +948,7 @@ the width specifier normally consists of spaces inserted on the left: If the width is too small, @code{format} does not truncate the object's printed representation. Thus, you can use a width to specify a minimum spacing between columns with no risk of losing information. -In the following three examples, @samp{%7s} specifies a minimum width +In the following two examples, @samp{%7s} specifies a minimum width of 7. In the first case, the string inserted in place of @samp{%7s} has only 3 letters, and needs 4 blank spaces as padding. In the second case, the string @code{"specification"} is 13 letters wide but @@ -995,8 +995,12 @@ specifier, if any, to be inserted on the right rather than the left. If both @samp{-} and @samp{0} are present, the @samp{0} flag is ignored. +@cindex curved quotes +@cindex curly quotes The flag @samp{q} quotes the printed representation as per the -variable @samp{text-quoting-style} described below. +variable @samp{text-quoting-style}. @xref{Keys in Documentation}. +Typically it uses curved single quotes @t{‘like this’} as in the +following example. @example @group diff --git a/src/syntax.c b/src/syntax.c index d45936b..30560af 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -1333,9 +1333,11 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, insert_string (" (nestable)"); if (prefix) - insert1 (Fsubstitute_command_keys - (build_string - (",\n\t is a prefix character for `backward-prefix-chars'"))); + { + AUTO_STRING (prefixdoc, + ",\n\t is a prefix character for `backward-prefix-chars'"); + insert1 (Fsubstitute_command_keys (prefixdoc)); + } return syntax; } commit 3caef97113438d69b6106ffacf5dac72d6a5f19e Author: Fabián Ezequiel Gallina Date: Sun Aug 23 16:53:02 2015 -0300 python.el: Defer shell setup code until first interactive prompt * lisp/progmodes/python.el (python-shell-comint-watch-for-first-prompt-output-filter): New function. (inferior-python-mode): Use it. (python-shell-first-prompt-hook): New hook. (python-shell-send-setup-code) (python-shell-completion-native-turn-on-maybe-with-msg): Attach to this hook instead of inferior-python-hook. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 93ef7fe..fbe5b8b 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2605,6 +2605,40 @@ With argument MSG show activation/deactivation message." (python-shell-font-lock-turn-off msg)) python-shell-font-lock-enable)) +(defvar python-shell--first-prompt-received-output-buffer nil) +(defvar python-shell--first-prompt-received nil) + +(defcustom python-shell-first-prompt-hook nil + "Hook run upon first (non-pdb) shell prompt detection. +This is the place for shell setup functions that need to wait for +output. Since the first prompt is ensured, this helps the +current process to not hang waiting for output by safeguarding +interactive actions can be performed. This is useful to safely +attach setup code for long-running processes that eventually +provide a shell." + :type 'hook + :group 'python) + +(defun python-shell-comint-watch-for-first-prompt-output-filter (output) + "Run `python-shell-first-prompt-hook' when first prompt is found in OUTPUT." + (when (not python-shell--first-prompt-received) + (set (make-local-variable 'python-shell--first-prompt-received-output-buffer) + (concat python-shell--first-prompt-received-output-buffer + (ansi-color-filter-apply output))) + (when (python-shell-comint-end-of-output-p + python-shell--first-prompt-received-output-buffer) + (if (string-match-p + (concat python-shell-prompt-pdb-regexp (rx eos)) + (or python-shell--first-prompt-received-output-buffer "")) + ;; Skip pdb prompts and reset the buffer. + (setq python-shell--first-prompt-received-output-buffer nil) + (set (make-local-variable 'python-shell--first-prompt-received) t) + (setq python-shell--first-prompt-received-output-buffer nil) + (with-current-buffer (current-buffer) + (let ((inhibit-quit nil)) + (run-hooks 'python-shell-first-prompt-hook)))))) + output) + ;; Used to hold user interactive overrides to ;; `python-shell-interpreter' and `python-shell-interpreter-args' that ;; will be made buffer-local by `inferior-python-mode': @@ -2654,6 +2688,7 @@ variable. (setq mode-line-process '(":%s")) (set (make-local-variable 'comint-output-filter-functions) '(ansi-color-process-output + python-shell-comint-watch-for-first-prompt-output-filter python-pdbtrack-comint-output-filter-function python-comint-postoutput-scroll-to-bottom)) (set (make-local-variable 'compilation-error-regexp-alist) @@ -2667,9 +2702,7 @@ variable. (make-local-variable 'python-shell-internal-last-output) (when python-shell-font-lock-enable (python-shell-font-lock-turn-on)) - (compilation-shell-minor-mode 1) - (python-shell-accept-process-output - (get-buffer-process (current-buffer)))) + (compilation-shell-minor-mode 1)) (defun python-shell-make-comint (cmd proc-name &optional show internal) "Create a Python shell comint buffer. @@ -3131,7 +3164,7 @@ This function takes the list of setup code to send from the (python-shell-send-string code process) (python-shell-accept-process-output process)))) -(add-hook 'inferior-python-mode-hook +(add-hook 'python-shell-first-prompt-hook #'python-shell-send-setup-code) @@ -3415,7 +3448,7 @@ With argument MSG show activation/deactivation message." "Like `python-shell-completion-native-turn-on-maybe' but force messages." (python-shell-completion-native-turn-on-maybe t)) -(add-hook 'inferior-python-mode-hook +(add-hook 'python-shell-first-prompt-hook #'python-shell-completion-native-turn-on-maybe-with-msg) (defun python-shell-completion-native-toggle (&optional msg) commit c13a4df51ca2b82c03ef13bca1151f727cfc64f6 Author: Nicolas Petton Date: Sun Aug 23 21:09:01 2015 +0200 Remove the calls to `seq-into` from `seq-concatenate` Since most new types of seq would have to be defined as sequences (cons cells or CL structs, mostly), there is no need to convert the seqs to sequences (which can be a fairly expensive operation). * lisp/emacs-lisp/seq.el (seq-concatenate): Do not ensure that seqs are sequences. diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index f9e0e9c..5ce4d91 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -200,18 +200,11 @@ The result is a sequence of the same type as SEQ." TYPE must be one of following symbols: vector, string or list. \n(fn TYPE SEQUENCE...)" - ;; Since new seq types might be defined, we need to make sure that - ;; all seqs are actual sequences. - (let ((sequences (seq-map (lambda (s) - (if (sequencep s) - s - (seq-into s 'list))) - seqs))) - (pcase type - (`vector (apply #'vconcat sequences)) - (`string (apply #'concat sequences)) - (`list (apply #'append (append sequences '(nil)))) - (_ (error "Not a sequence type name: %S" type))))) + (pcase type + (`vector (apply #'vconcat seqs)) + (`string (apply #'concat seqs)) + (`list (apply #'append (append seqs '(nil)))) + (_ (error "Not a sequence type name: %S" type)))) (cl-defgeneric seq-into (seq type) "Convert the sequence SEQ into a sequence of type TYPE. commit 20aa61c0a3c152e5b829d02ea20a4d89c692b91b Author: Eli Zaretskii Date: Sun Aug 23 20:57:53 2015 +0300 ; Fix a typo in description of 'C-x r i' * doc/emacs/regs.texi (Text Registers): Fix a typo. Reported by Lubos Pintes . (Bug#21332) diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi index dc53c3b..fd48f34 100644 --- a/doc/emacs/regs.texi +++ b/doc/emacs/regs.texi @@ -151,7 +151,7 @@ during the collection process, you can use the following setting. @kbd{C-x r i @var{r}} inserts in the buffer the text from register @var{r}. Normally it leaves point after the text and sets the mark before, without activating it. With a numeric argument, it instead -puts before after the text and the mark after. +puts point before the text and the mark after. @node Rectangle Registers @section Saving Rectangles in Registers commit a92066b80e4245f5093fa1ed481f0e3eb377f504 Author: Fabián Ezequiel Gallina Date: Sun Aug 23 14:54:56 2015 -0300 python.el: Fix completion for pdb interactions * lisp/progmodes/python.el (python-shell-completion-setup-code): Simplify. Toggle print_mode for native wrapped completer. (python-shell-completion-native-setup): Ensure process buffer. Add print_mode attribute to completer wrapper to toggle returning or printing candidates. (python-shell-completion-native-get-completions): Cleanup. (python-shell-completion-get-completions): Cleanup. (python-shell-completion-at-point): Perform prompt checks. Force fallback completion in pdb interactions. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 426b465..93ef7fe 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3138,50 +3138,56 @@ This function takes the list of setup code to send from the ;;; Shell completion (defcustom python-shell-completion-setup-code - "try: - import readline -except: - def __PYTHON_EL_get_completions(text): - return [] -else: - def __PYTHON_EL_get_completions(text): + " +def __PYTHON_EL_get_completions(text): + completions = [] + completer = None + + try: + import readline + try: import __builtin__ except ImportError: # Python 3 import builtins as __builtin__ builtins = dir(__builtin__) - completions = [] + is_ipython = ('__IPYTHON__' in builtins or '__IPYTHON__active' in builtins) splits = text.split() is_module = splits and splits[0] in ('from', 'import') - try: - if is_ipython and is_module: - from IPython.core.completerlib import module_completion - completions = module_completion(text.strip()) - elif is_ipython and '__IP' in builtins: - completions = __IP.complete(text) - elif is_ipython and 'get_ipython' in builtins: - completions = get_ipython().Completer.all_completions(text) - else: - # Try to reuse current completer. + + if is_ipython and is_module: + from IPython.core.completerlib import module_completion + completions = module_completion(text.strip()) + elif is_ipython and '__IP' in builtins: + completions = __IP.complete(text) + elif is_ipython and 'get_ipython' in builtins: + completions = get_ipython().Completer.all_completions(text) + else: + # Try to reuse current completer. + completer = readline.get_completer() + if not completer: + # importing rlcompleter sets the completer, use it as a + # last resort to avoid breaking customizations. + import rlcompleter completer = readline.get_completer() - if not completer: - # importing rlcompleter sets the completer, use it as a - # last resort to avoid breaking customizations. - import rlcompleter - completer = readline.get_completer() - i = 0 - while True: - completion = completer(text, i) - if not completion: - break - i += 1 - completions.append(completion) - except: - pass - return completions" + if getattr(completer, 'PYTHON_EL_WRAPPED', False): + completer.print_mode = False + i = 0 + while True: + completion = completer(text, i) + if not completion: + break + i += 1 + completions.append(completion) + except: + pass + finally: + if getattr(completer, 'PYTHON_EL_WRAPPED', False): + completer.print_mode = True + return completions" "Code used to setup completion in inferior Python processes." :type 'string :group 'python) @@ -3243,12 +3249,13 @@ When a match is found, native completion is disabled." python-shell-completion-native-try-output-timeout)) (python-shell-completion-native-get-completions (get-buffer-process (current-buffer)) - nil "int"))) + nil ""))) (defun python-shell-completion-native-setup () "Try to setup native completion, return non-nil on success." (let ((process (python-shell-get-process))) - (python-shell-send-string " + (with-current-buffer (process-buffer process) + (python-shell-send-string " def __PYTHON_EL_native_completion_setup(): try: import readline @@ -3283,6 +3290,7 @@ def __PYTHON_EL_native_completion_setup(): def __init__(self, completer): self.completer = completer self.last_completion = None + self.print_mode = True def __call__(self, text, state): if state == 0: @@ -3312,8 +3320,11 @@ def __PYTHON_EL_native_completion_setup(): # For every non-dummy completion, return a repeated dummy # one and print the real candidate so it can be retrieved # by comint output filters. - print (completion) - return '0__dummy_completion__' + if self.print_mode: + print (completion) + return '0__dummy_completion__' + else: + return completion else: return completion @@ -3346,17 +3357,18 @@ def __PYTHON_EL_native_completion_setup(): # Require just one tab to send output. readline.parse_and_bind('set show-all-if-ambiguous on') - print ('python.el: readline is available') + print ('python.el: native completion setup loaded') except: - print ('python.el: readline not available') + print ('python.el: native completion setup failed') -__PYTHON_EL_native_completion_setup()" - process) - (python-shell-accept-process-output process) - (when (save-excursion - (re-search-backward - (regexp-quote "python.el: readline is available") nil t 1)) - (python-shell-completion-native-try)))) +__PYTHON_EL_native_completion_setup()" process) + (when (and + (python-shell-accept-process-output + process python-shell-completion-native-try-output-timeout) + (save-excursion + (re-search-backward + (regexp-quote "python.el: native completion setup loaded") nil t 1))) + (python-shell-completion-native-try))))) (defun python-shell-completion-native-turn-off (&optional msg) "Turn off shell native completions. @@ -3421,91 +3433,75 @@ With argument MSG show activation/deactivation message." When IMPORT is non-nil takes precedence over INPUT for completion." (with-current-buffer (process-buffer process) - (when (and python-shell-completion-native-enable - (python-util-comint-last-prompt) - (>= (point) (cdr (python-util-comint-last-prompt)))) - (let* ((input (or import input)) - (original-filter-fn (process-filter process)) - (redirect-buffer (get-buffer-create - python-shell-completion-native-redirect-buffer)) - (trigger "\t") - (new-input (concat input trigger)) - (input-length - (save-excursion - (+ (- (point-max) (comint-bol)) (length new-input)))) - (delete-line-command (make-string input-length ?\b)) - (input-to-send (concat new-input delete-line-command))) - ;; Ensure restoring the process filter, even if the user quits - ;; or there's some other error. - (unwind-protect - (with-current-buffer redirect-buffer - ;; Cleanup the redirect buffer - (erase-buffer) - ;; Mimic `comint-redirect-send-command', unfortunately it - ;; can't be used here because it expects a newline in the - ;; command and that's exactly what we are trying to avoid. - (let ((comint-redirect-echo-input nil) - (comint-redirect-completed nil) - (comint-redirect-perform-sanity-check nil) - (comint-redirect-insert-matching-regexp t) - (comint-redirect-finished-regexp - "1__dummy_completion__[[:space:]]*\n") - (comint-redirect-output-buffer redirect-buffer)) - ;; Compatibility with Emacs 24.x. Comint changed and - ;; now `comint-redirect-filter' gets 3 args. This - ;; checks which version of `comint-redirect-filter' is - ;; in use based on its args and uses `apply-partially' - ;; to make it up for the 3 args case. - (if (= (length - (help-function-arglist 'comint-redirect-filter)) 3) - (set-process-filter - process (apply-partially - #'comint-redirect-filter original-filter-fn)) - (set-process-filter process #'comint-redirect-filter)) - (process-send-string process input-to-send) - ;; Grab output until our dummy completion used as - ;; output end marker is found. - (when (python-shell-accept-process-output - process python-shell-completion-native-output-timeout - comint-redirect-finished-regexp) - (re-search-backward "0__dummy_completion__" nil t) - (cl-remove-duplicates - (split-string - (buffer-substring-no-properties - (line-beginning-position) (point-min)) - "[ \f\t\n\r\v()]+" t) - :test #'string=)))) - (set-process-filter process original-filter-fn)))))) + (let* ((input (or import input)) + (original-filter-fn (process-filter process)) + (redirect-buffer (get-buffer-create + python-shell-completion-native-redirect-buffer)) + (trigger "\t") + (new-input (concat input trigger)) + (input-length + (save-excursion + (+ (- (point-max) (comint-bol)) (length new-input)))) + (delete-line-command (make-string input-length ?\b)) + (input-to-send (concat new-input delete-line-command))) + ;; Ensure restoring the process filter, even if the user quits + ;; or there's some other error. + (unwind-protect + (with-current-buffer redirect-buffer + ;; Cleanup the redirect buffer + (erase-buffer) + ;; Mimic `comint-redirect-send-command', unfortunately it + ;; can't be used here because it expects a newline in the + ;; command and that's exactly what we are trying to avoid. + (let ((comint-redirect-echo-input nil) + (comint-redirect-completed nil) + (comint-redirect-perform-sanity-check nil) + (comint-redirect-insert-matching-regexp t) + (comint-redirect-finished-regexp + "1__dummy_completion__[[:space:]]*\n") + (comint-redirect-output-buffer redirect-buffer)) + ;; Compatibility with Emacs 24.x. Comint changed and + ;; now `comint-redirect-filter' gets 3 args. This + ;; checks which version of `comint-redirect-filter' is + ;; in use based on its args and uses `apply-partially' + ;; to make it up for the 3 args case. + (if (= (length + (help-function-arglist 'comint-redirect-filter)) 3) + (set-process-filter + process (apply-partially + #'comint-redirect-filter original-filter-fn)) + (set-process-filter process #'comint-redirect-filter)) + (process-send-string process input-to-send) + ;; Grab output until our dummy completion used as + ;; output end marker is found. + (when (python-shell-accept-process-output + process python-shell-completion-native-output-timeout + comint-redirect-finished-regexp) + (re-search-backward "0__dummy_completion__" nil t) + (cl-remove-duplicates + (split-string + (buffer-substring-no-properties + (line-beginning-position) (point-min)) + "[ \f\t\n\r\v()]+" t) + :test #'string=)))) + (set-process-filter process original-filter-fn))))) (defun python-shell-completion-get-completions (process import input) "Do completion at point using PROCESS for IMPORT or INPUT. When IMPORT is non-nil takes precedence over INPUT for completion." + (setq input (or import input)) (with-current-buffer (process-buffer process) - (let* ((prompt - (let ((prompt-boundaries (python-util-comint-last-prompt))) - (buffer-substring-no-properties - (car prompt-boundaries) (cdr prompt-boundaries)))) - (completion-code - ;; Check whether a prompt matches a pdb string, an import - ;; statement or just the standard prompt and use the - ;; correct python-shell-completion-*-code string - (when (string-match python-shell--prompt-calculated-input-regexp prompt) - ;; Since there are no guarantees the user will remain - ;; in the same context where completion code was sent - ;; (e.g. user steps into a function), safeguard - ;; resending completion setup continuously. + (let ((completions + (python-util-strip-string + (python-shell-send-string-no-output + (format (concat python-shell-completion-setup-code - "\nprint (" python-shell-completion-string-code ")"))) - (subject (or import input))) - (when (and completion-code (> (length input) 0)) - (let ((completions - (python-util-strip-string - (python-shell-send-string-no-output - (format completion-code subject) process)))) - (when (> (length completions) 2) - (split-string completions - "^'\\|^\"\\|;\\|'$\\|\"$" t))))))) + "\nprint (" python-shell-completion-string-code ")") + input) process)))) + (when (> (length completions) 2) + (split-string completions + "^'\\|^\"\\|;\\|'$\\|\"$" t))))) (defun python-shell-completion-at-point (&optional process) "Function for `completion-at-point-functions' in `inferior-python-mode'. @@ -3532,10 +3528,26 @@ using that one instead of current buffer's process." (forward-char (length (match-string-no-properties 0))) (point)))) (end (point)) + (prompt-boundaries (python-util-comint-last-prompt)) + (prompt + (with-current-buffer (process-buffer process) + (when prompt-boundaries + (buffer-substring-no-properties + (car prompt-boundaries) (cdr prompt-boundaries))))) (completion-fn - (if python-shell-completion-native-enable - #'python-shell-completion-native-get-completions - #'python-shell-completion-get-completions))) + (with-current-buffer (process-buffer process) + (cond ((or (null prompt) + (< (point) (cdr prompt-boundaries))) + #'ignore) + ((or (not python-shell-completion-native-enable) + ;; Even if native completion is enabled, for + ;; pdb interaction always use the fallback + ;; mechanism since the completer is changed. + ;; Also, since pdb interaction is single-line + ;; based, this is enough. + (string-match-p python-shell-prompt-pdb-regexp prompt)) + #'python-shell-completion-get-completions) + (t #'python-shell-completion-native-get-completions))))) (list start end (completion-table-dynamic (apply-partially commit e7be9861962a5a399047e86a254c2534d5d4d146 Author: Nicolas Petton Date: Fri Aug 14 22:33:10 2015 +0200 Make seq.el more extensible by using cl-defmethod * lisp/emacs-lisp/seq.el: Define seq.el functions using cl-defmethod to make it easier to extend seq.el with new "seq types". * test/automated/seq-tests.el (test-setf-seq-elt): New test. * lisp/emacs-lisp/cl-extra.el (cl-subseq): Move back the definition of subseq in cl-extra.el, and use it in seq.el. diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 8ed50f4..90ca531 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -38,7 +38,6 @@ ;;; Code: (require 'cl-lib) -(require 'seq) ;;; Type coercion. @@ -520,13 +519,32 @@ This sets the values of: `cl-most-positive-float', `cl-most-negative-float', If END is omitted, it defaults to the length of the sequence. If START or END is negative, it counts from the end. Signal an error if START or END are outside of the sequence (i.e -too large if positive or too small if negative)" +too large if positive or too small if negative)." (declare (gv-setter (lambda (new) (macroexp-let2 nil new new `(progn (cl-replace ,seq ,new :start1 ,start :end1 ,end) ,new))))) - (seq-subseq seq start end)) + (cond ((or (stringp seq) (vectorp seq)) (substring seq start end)) + ((listp seq) + (let (len + (errtext (format "Bad bounding indices: %s, %s" start end))) + (and end (< end 0) (setq end (+ end (setq len (seq-length seq))))) + (if (< start 0) (setq start (+ start (or len (setq len (seq-length seq)))))) + (unless (>= start 0) + (error "%s" errtext)) + (when (> start 0) + (setq seq (nthcdr (1- start) seq)) + (or seq (error "%s" errtext)) + (setq seq (cdr seq))) + (if end + (let ((res nil)) + (while (and (>= (setq end (1- end)) start) seq) + (push (pop seq) res)) + (or (= (1+ end) start) (error "%s" errtext)) + (nreverse res)) + (seq-copy seq)))) + (t (error "Unsupported sequence: %s" seq)))) ;;;###autoload (defalias 'cl-concatenate #'seq-concatenate diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 038b20e..f9e0e9c 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -4,7 +4,7 @@ ;; Author: Nicolas Petton ;; Keywords: sequences -;; Version: 1.8 +;; Version: 2.0 ;; Package: seq ;; Maintainer: emacs-devel@gnu.org @@ -38,10 +38,26 @@ ;; the sequence as their second argument. All other functions take ;; the sequence as their first argument. ;; +;; While seq.el version 1.8 is in GNU ELPA for convenience, seq.el +;; version 2.0 requires Emacs>=25.1. +;; +;; seq.el can be extended to support new type of sequences. Here are +;; the generic functions that must be implemented by new seq types: +;; - `seq-elt' +;; - `seq-length' +;; - `seq-do' +;; - `seq-p' +;; - `seq-subseq' +;; - `seq-copy' +;; - `seq-into' +;; ;; All functions are tested in test/automated/seq-tests.el ;;; Code: +(eval-when-compile (require 'cl-generic)) +(require 'cl-extra) ;; for cl-subseq + (defmacro seq-doseq (spec &rest body) "Loop over a sequence. Similar to `dolist' but can be applied to lists, strings, and vectors. @@ -50,91 +66,163 @@ Evaluate BODY with VAR bound to each element of SEQ, in turn. \(fn (VAR SEQ) BODY...)" (declare (indent 1) (debug ((symbolp form &optional form) body))) - (let ((length (make-symbol "length")) - (seq (make-symbol "seq")) - (index (make-symbol "index"))) - `(let* ((,seq ,(cadr spec)) - (,length (if (listp ,seq) nil (seq-length ,seq))) - (,index (if ,length 0 ,seq))) - (while (if ,length - (< ,index ,length) - (consp ,index)) - (let ((,(car spec) (if ,length - (prog1 (seq-elt ,seq ,index) - (setq ,index (+ ,index 1))) - (pop ,index)))) - ,@body))))) - -(if (fboundp 'pcase-defmacro) - ;; Implementation of `seq-let' based on a `pcase' - ;; pattern. Requires Emacs>=25.1. - (progn - (pcase-defmacro seq (&rest args) - "pcase pattern matching sequence elements. + `(seq-do (lambda (,(car spec)) + ,@body) + ,(cadr spec))) + +(pcase-defmacro seq (&rest args) + "pcase pattern matching sequence elements. Matches if the object is a sequence (list, string or vector), and binds each element of ARGS to the corresponding element of the sequence." - `(and (pred seq-p) - ,@(seq--make-pcase-bindings args))) + `(and (pred seq-p) + ,@(seq--make-pcase-bindings args))) - (defmacro seq-let (args seq &rest body) - "Bind the variables in ARGS to the elements of SEQ then evaluate BODY. +(defmacro seq-let (args seq &rest body) + "Bind the variables in ARGS to the elements of SEQ then evaluate BODY. ARGS can also include the `&rest' marker followed by a variable name to be bound to the rest of SEQ." - (declare (indent 2) (debug t)) - `(pcase-let ((,(seq--make-pcase-patterns args) ,seq)) - ,@body))) + (declare (indent 2) (debug t)) + `(pcase-let ((,(seq--make-pcase-patterns args) ,seq)) + ,@body)) + + +;;; Basic seq functions that have to be implemented by new seq types +(cl-defgeneric seq-elt (seq n) + "Return the element of SEQ at index N." + (elt seq n)) + +;; Default gv setters for `seq-elt'. +;; It can be a good idea for new sequence impelentations to provide a +;; "gv-setter" for `seq-elt'. +(cl-defmethod (setf seq-elt) (store (seq array) n) + (aset seq n store)) + +(cl-defmethod (setf seq-elt) (store (seq cons) n) + (setcar (nthcdr n seq) store)) + +(cl-defgeneric seq-length (seq) + "Return the length of the sequence SEQ." + (length seq)) + +(cl-defgeneric seq-do (function seq) + "Apply FUNCTION to each element of SEQ, presumably for side effects. +Return SEQ." + (mapc function seq)) - ;; Implementation of `seq-let' compatible with Emacs<25.1. - (defmacro seq-let (args seq &rest body) - "Bind the variables in ARGS to the elements of SEQ then evaluate BODY. +(defalias 'seq-each #'seq-do) -ARGS can also include the `&rest' marker followed by a variable -name to be bound to the rest of SEQ." - (declare (indent 2) (debug t)) - (let ((seq-var (make-symbol "seq"))) - `(let* ((,seq-var ,seq) - ,@(seq--make-bindings args seq-var)) - ,@body)))) +(cl-defgeneric seq-p (seq) + "Return non-nil if SEQ is a sequence, nil otherwise." + (sequencep seq)) + +(cl-defgeneric seq-copy (seq) + "Return a shallow copy of SEQ." + (copy-sequence seq)) + +(cl-defgeneric seq-subseq (seq start &optional end) + "Return the subsequence of SEQ from START to END. +If END is omitted, it defaults to the length of the sequence. +If START or END is negative, it counts from the end. +Signal an error if START or END are outside of the sequence (i.e +too large if positive or too small if negative)." + (cl-subseq seq start end)) + + +(cl-defgeneric seq-map (function seq) + "Return the result of applying FUNCTION to each element of SEQ." + (let (result) + (seq-do (lambda (elt) + (push (funcall function elt) result)) + seq) + (nreverse result))) + +;; faster implementation for sequences (sequencep) +(cl-defmethod seq-map (function (seq sequence)) + (mapcar function seq)) -(defun seq-drop (seq n) +(cl-defgeneric seq-drop (seq n) "Return a subsequence of SEQ without its first N elements. The result is a sequence of the same type as SEQ. If N is a negative integer or zero, SEQ is returned." (if (<= n 0) seq - (if (listp seq) - (seq--drop-list seq n) - (let ((length (seq-length seq))) - (seq-subseq seq (min n length) length))))) + (let ((length (seq-length seq))) + (seq-subseq seq (min n length) length)))) -(defun seq-take (seq n) +(cl-defgeneric seq-take (seq n) "Return a subsequence of SEQ with its first N elements. The result is a sequence of the same type as SEQ. If N is a negative integer or zero, an empty sequence is returned." - (if (listp seq) - (seq--take-list seq n) - (seq-subseq seq 0 (min (max n 0) (seq-length seq))))) + (seq-subseq seq 0 (min (max n 0) (seq-length seq)))) -(defun seq-drop-while (pred seq) +(cl-defgeneric seq-drop-while (pred seq) "Return a sequence from the first element for which (PRED element) is nil in SEQ. The result is a sequence of the same type as SEQ." - (if (listp seq) - (seq--drop-while-list pred seq) - (seq-drop seq (seq--count-successive pred seq)))) + (seq-drop seq (seq--count-successive pred seq))) -(defun seq-take-while (pred seq) +(cl-defgeneric seq-take-while (pred seq) "Return the successive elements for which (PRED element) is non-nil in SEQ. The result is a sequence of the same type as SEQ." - (if (listp seq) - (seq--take-while-list pred seq) - (seq-take seq (seq--count-successive pred seq)))) + (seq-take seq (seq--count-successive pred seq))) -(defun seq-filter (pred seq) +(cl-defgeneric seq-empty-p (seq) + "Return non-nil if the sequence SEQ is empty, nil otherwise." + (= 0 (seq-length seq))) + +(cl-defgeneric seq-sort (pred seq) + "Return a sorted sequence comparing using PRED the elements of SEQ. +The result is a sequence of the same type as SEQ." + (let ((result (seq-sort pred (append seq nil)))) + (seq-into result (type-of seq)))) + +(cl-defmethod seq-sort (pred (list list)) + (sort (seq-copy list) pred)) + +(cl-defgeneric seq-reverse (seq) + "Return the reversed shallow copy of SEQ." + (let ((result '())) + (seq-map (lambda (elt) + (push elt result)) + seq) + (seq-into result (type-of seq)))) + +;; faster implementation for sequences (sequencep) +(cl-defmethod seq-reverse ((seq sequence)) + (reverse seq)) + +(cl-defgeneric seq-concatenate (type &rest seqs) + "Concatenate, into a sequence of type TYPE, the sequences SEQS. +TYPE must be one of following symbols: vector, string or list. + +\n(fn TYPE SEQUENCE...)" + ;; Since new seq types might be defined, we need to make sure that + ;; all seqs are actual sequences. + (let ((sequences (seq-map (lambda (s) + (if (sequencep s) + s + (seq-into s 'list))) + seqs))) + (pcase type + (`vector (apply #'vconcat sequences)) + (`string (apply #'concat sequences)) + (`list (apply #'append (append sequences '(nil)))) + (_ (error "Not a sequence type name: %S" type))))) + +(cl-defgeneric seq-into (seq type) + "Convert the sequence SEQ into a sequence of type TYPE. +TYPE can be one of the following symbols: vector, string or list." + (pcase type + (`vector (vconcat seq)) + (`string (concat seq)) + (`list (append seq nil)) + (_ (error "Not a sequence type name: %S" type)))) + +(cl-defgeneric seq-filter (pred seq) "Return a list of all the elements for which (PRED element) is non-nil in SEQ." (let ((exclude (make-symbol "exclude"))) (delq exclude (seq-map (lambda (elt) @@ -143,12 +231,12 @@ The result is a sequence of the same type as SEQ." exclude)) seq)))) -(defun seq-remove (pred seq) +(cl-defgeneric seq-remove (pred seq) "Return a list of all the elements for which (PRED element) is nil in SEQ." (seq-filter (lambda (elt) (not (funcall pred elt))) seq)) -(defun seq-reduce (function seq initial-value) +(cl-defgeneric seq-reduce (function seq initial-value) "Reduce the function FUNCTION across SEQ, starting with INITIAL-VALUE. Return the result of calling FUNCTION with INITIAL-VALUE and the @@ -164,7 +252,7 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not called." (setq acc (funcall function acc elt))) acc))) -(defun seq-some-p (pred seq) +(cl-defgeneric seq-some-p (pred seq) "Return any element for which (PRED element) is non-nil in SEQ, nil otherwise." (catch 'seq--break (seq-doseq (elt seq) @@ -172,7 +260,7 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not called." (throw 'seq--break elt))) nil)) -(defun seq-every-p (pred seq) +(cl-defgeneric seq-every-p (pred seq) "Return non-nil if (PRED element) is non-nil for all elements of the sequence SEQ." (catch 'seq--break (seq-doseq (elt seq) @@ -180,7 +268,7 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not called." (throw 'seq--break nil))) t)) -(defun seq-count (pred seq) +(cl-defgeneric seq-count (pred seq) "Return the number of elements for which (PRED element) is non-nil in SEQ." (let ((count 0)) (seq-doseq (elt seq) @@ -188,28 +276,14 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not called." (setq count (+ 1 count)))) count)) -(defun seq-empty-p (seq) - "Return non-nil if the sequence SEQ is empty, nil otherwise." - (if (listp seq) - (null seq) - (= 0 (seq-length seq)))) - -(defun seq-sort (pred seq) - "Return a sorted sequence comparing using PRED the elements of SEQ. -The result is a sequence of the same type as SEQ." - (if (listp seq) - (sort (seq-copy seq) pred) - (let ((result (seq-sort pred (append seq nil)))) - (seq-into result (type-of seq))))) - -(defun seq-contains-p (seq elt &optional testfn) +(cl-defgeneric seq-contains-p (seq elt &optional testfn) "Return the first element in SEQ that equals to ELT. Equality is defined by TESTFN if non-nil or by `equal' if nil." (seq-some-p (lambda (e) (funcall (or testfn #'equal) elt e)) seq)) -(defun seq-uniq (seq &optional testfn) +(cl-defgeneric seq-uniq (seq &optional testfn) "Return a list of the elements of SEQ with duplicates removed. TESTFN is used to compare elements, or `equal' if TESTFN is nil." (let ((result '())) @@ -218,51 +292,13 @@ TESTFN is used to compare elements, or `equal' if TESTFN is nil." (setq result (cons elt result)))) (nreverse result))) -(defun seq-subseq (seq start &optional end) - "Return the subsequence of SEQ from START to END. -If END is omitted, it defaults to the length of the sequence. -If START or END is negative, it counts from the end. - -Signal an error if START or END are outside of the sequence (i.e -too large if positive or too small if negative)" - (cond ((or (stringp seq) (vectorp seq)) (substring seq start end)) - ((listp seq) - (let (len (errtext (format "Bad bounding indices: %s, %s" start end))) - (and end (< end 0) (setq end (+ end (setq len (seq-length seq))))) - (if (< start 0) (setq start (+ start (or len (setq len (seq-length seq)))))) - (unless (>= start 0) - (error "%s" errtext)) - (when (> start 0) - (setq seq (nthcdr (1- start) seq)) - (or seq (error "%s" errtext)) - (setq seq (cdr seq))) - (if end - (let ((res nil)) - (while (and (>= (setq end (1- end)) start) seq) - (push (pop seq) res)) - (or (= (1+ end) start) (error "%s" errtext)) - (nreverse res)) - (seq-copy seq)))) - (t (error "Unsupported sequence: %s" seq)))) - -(defun seq-concatenate (type &rest seqs) - "Concatenate, into a sequence of type TYPE, the sequences SEQS. -TYPE must be one of following symbols: vector, string or list. - -\n(fn TYPE SEQUENCE...)" - (pcase type - (`vector (apply #'vconcat seqs)) - (`string (apply #'concat seqs)) - (`list (apply #'append (append seqs '(nil)))) - (_ (error "Not a sequence type name: %S" type)))) - -(defun seq-mapcat (function seq &optional type) +(cl-defgeneric seq-mapcat (function seq &optional type) "Concatenate the result of applying FUNCTION to each element of SEQ. The result is a sequence of type TYPE, or a list if TYPE is nil." (apply #'seq-concatenate (or type 'list) (seq-map function seq))) -(defun seq-partition (seq n) +(cl-defgeneric seq-partition (seq n) "Return a list of the elements of SEQ grouped into sub-sequences of length N. The last sequence may contain less than N elements. If N is a negative integer or 0, nil is returned." @@ -273,7 +309,7 @@ negative integer or 0, nil is returned." (setq seq (seq-drop seq n))) (nreverse result)))) -(defun seq-intersection (seq1 seq2 &optional testfn) +(cl-defgeneric seq-intersection (seq1 seq2 &optional testfn) "Return a list of the elements that appear in both SEQ1 and SEQ2. Equality is defined by TESTFN if non-nil or by `equal' if nil." (seq-reduce (lambda (acc elt) @@ -283,7 +319,7 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil." (seq-reverse seq1) '())) -(defun seq-difference (seq1 seq2 &optional testfn) +(cl-defgeneric seq-difference (seq1 seq2 &optional testfn) "Return a list of the elements that appear in SEQ1 but not in SEQ2. Equality is defined by TESTFN if non-nil or by `equal' if nil." (seq-reduce (lambda (acc elt) @@ -293,7 +329,7 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil." (seq-reverse seq1) '())) -(defun seq-group-by (function seq) +(cl-defgeneric seq-group-by (function seq) "Apply FUNCTION to each element of SEQ. Separate the elements of SEQ into an alist using the results as keys. Keys are compared using `equal'." @@ -308,70 +344,16 @@ keys. Keys are compared using `equal'." (seq-reverse seq) nil)) -(defalias 'seq-reverse - (if (ignore-errors (reverse [1 2])) - #'reverse - (lambda (seq) - "Return the reversed copy of list, vector, or string SEQ. -See also the function `nreverse', which is used more often." - (let ((result '())) - (seq-map (lambda (elt) (push elt result)) - seq) - (if (listp seq) - result - (seq-into result (type-of seq))))))) - -(defun seq-into (seq type) - "Convert the sequence SEQ into a sequence of type TYPE. -TYPE can be one of the following symbols: vector, string or list." - (pcase type - (`vector (vconcat seq)) - (`string (concat seq)) - (`list (append seq nil)) - (_ (error "Not a sequence type name: %S" type)))) - -(defun seq-min (seq) +(cl-defgeneric seq-min (seq) "Return the smallest element of SEQ. SEQ must be a sequence of numbers or markers." (apply #'min (seq-into seq 'list))) -(defun seq-max (seq) - "Return the largest element of SEQ. +(cl-defgeneric seq-max (seq) + "Return the largest element of SEQ. SEQ must be a sequence of numbers or markers." (apply #'max (seq-into seq 'list))) -(defun seq--drop-list (list n) - "Return a list from LIST without its first N elements. -This is an optimization for lists in `seq-drop'." - (while (and list (> n 0)) - (setq list (cdr list) - n (1- n))) - list) - -(defun seq--take-list (list n) - "Return a list from LIST made of its first N elements. -This is an optimization for lists in `seq-take'." - (let ((result '())) - (while (and list (> n 0)) - (setq n (1- n)) - (push (pop list) result)) - (nreverse result))) - -(defun seq--drop-while-list (pred list) - "Return a list from the first element for which (PRED element) is nil in LIST. -This is an optimization for lists in `seq-drop-while'." - (while (and list (funcall pred (car list))) - (setq list (cdr list))) - list) - -(defun seq--take-while-list (pred list) - "Return the successive elements for which (PRED element) is non-nil in LIST. -This is an optimization for lists in `seq-take-while'." - (let ((result '())) - (while (and list (funcall pred (car list))) - (push (pop list) result)) - (nreverse result))) - (defun seq--count-successive (pred seq) "Return the number of successive elements for which (PRED element) is non-nil in SEQ." (let ((n 0) @@ -408,52 +390,52 @@ This is an optimization for lists in `seq-take-while'." elt)) args))) -;; Helper function for the Backward-compatible version of `seq-let' -;; for Emacs<25.1. -(defun seq--make-bindings (args seq &optional bindings) - "Return a list of bindings of the variables in ARGS to the elements of a sequence. -if BINDINGS is non-nil, append new bindings to it, and return -BINDINGS." - (let ((index 0) - (rest-marker nil)) - (seq-doseq (name args) - (unless rest-marker - (pcase name - ((pred seq-p) - (setq bindings (seq--make-bindings (seq--elt-safe args index) - `(seq--elt-safe ,seq ,index) - bindings))) - (`&rest - (progn (push `(,(seq--elt-safe args (1+ index)) - (seq-drop ,seq ,index)) - bindings) - (setq rest-marker t))) - (_ - (push `(,name (seq--elt-safe ,seq ,index)) bindings)))) - (setq index (1+ index))) - bindings)) - +;; TODO: make public? (defun seq--elt-safe (seq n) "Return element of SEQ at the index N. If no element is found, return nil." - (when (or (listp seq) - (and (sequencep seq) - (> (seq-length seq) n))) - (seq-elt seq n))) + (ignore-errors (seq-elt seq n))) + + +;;; Optimized implementations for lists + +(cl-defmethod seq-drop ((list list) n) + "Optimized implementation of `seq-drop' for lists." + (while (and list (> n 0)) + (setq list (cdr list) + n (1- n))) + list) + +(cl-defmethod seq-take ((list list) n) + "Optimized implementation of `seq-take' for lists." + (let ((result '())) + (while (and list (> n 0)) + (setq n (1- n)) + (push (pop list) result)) + (nreverse result))) + +(cl-defmethod seq-drop-while (pred (list list)) + "Optimized implementation of `seq-drop-while' for lists" + (while (and list (funcall pred (car list))) + (setq list (cdr list))) + list) + +(cl-defmethod seq-drop-while (pred (list list)) + "Optimized implementation of `seq-drop-while' for lists" + (while (and list (funcall pred (car list))) + (setq list (cdr list))) + list) + +(cl-defmethod seq-empty-p ((list list)) + "Optimized implementation of `seq-empty-p' for lists." + (null list)) + (defun seq--activate-font-lock-keywords () "Activate font-lock keywords for some symbols defined in seq." (font-lock-add-keywords 'emacs-lisp-mode '("\\" "\\"))) -(defalias 'seq-copy #'copy-sequence) -(defalias 'seq-elt #'elt) -(defalias 'seq-length #'length) -(defalias 'seq-do #'mapc) -(defalias 'seq-each #'seq-do) -(defalias 'seq-map #'mapcar) -(defalias 'seq-p #'sequencep) - (unless (fboundp 'elisp--font-lock-flush-elisp-buffers) ;; In Emacs≥25, (via elisp--font-lock-flush-elisp-buffers and a few others) ;; we automatically highlight macros. diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el index 74c0700..163935b 100644 --- a/test/automated/seq-tests.el +++ b/test/automated/seq-tests.el @@ -54,6 +54,11 @@ Evaluate BODY for each created sequence. "Return t if INTEGER is odd." (not (test-sequences-evenp integer))) +(ert-deftest test-setf-seq-elt () + (with-test-sequences (seq '(1 2 3)) + (setf (seq-elt seq 1) 4) + (should (= 4 (seq-elt seq 1))))) + (ert-deftest test-seq-drop () (with-test-sequences (seq '(1 2 3 4)) (should (equal (seq-drop seq 0) seq)) @@ -192,7 +197,7 @@ Evaluate BODY for each created sequence. (should-error (seq-subseq [] -1)) (should-error (seq-subseq "" -1)) (should-not (seq-subseq '() 0)) - (should-error(seq-subseq '() 0 -1))) + (should-error (seq-subseq '() 0 -1))) (ert-deftest test-seq-concatenate () (with-test-sequences (seq '(2 4 6)) commit 58c3762a8b8cfcf714539bda7114f52b6f615258 Author: Fabián Ezequiel Gallina Date: Sun Aug 23 13:58:17 2015 -0300 python.el: Fix prompt detection with user overridden interpreter * lisp/progmodes/python.el (python-shell-prompt-detect): Honor buffer local python-shell-interpreter and python-shell-interpreter-interactive-arg. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3bfc5cf..426b465 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2200,6 +2200,8 @@ detection and just returns nil." "ps_json = '\\n[\"%s\", \"%s\", \"%s\"]\\n' % tuple(ps)\n" "print (ps_json)\n" "sys.exit(0)\n")) + (interpreter python-shell-interpreter) + (interpreter-arg python-shell-interpreter-interactive-arg) (output (with-temp-buffer ;; TODO: improve error handling by using @@ -2209,11 +2211,11 @@ detection and just returns nil." (let ((code-file (python-shell--save-temp-file code))) ;; Use `process-file' as it is remote-host friendly. (process-file - python-shell-interpreter + interpreter code-file '(t nil) nil - python-shell-interpreter-interactive-arg) + interpreter-arg) ;; Try to cleanup (delete-file code-file))) (buffer-string))) commit a7088b50273287cd62eb222d3f1a4b12bd7dddba Author: Michael Albinus Date: Sun Aug 23 17:58:16 2015 +0200 ; Fix author address diff --git a/ChangeLog.2 b/ChangeLog.2 index 2da3e73..2286a82 100644 --- a/ChangeLog.2 +++ b/ChangeLog.2 @@ -792,7 +792,7 @@ * lisp/net/trampver.el (tramp-repository-get-version): Use `tramp-compat-replace-regexp-in-string'. -2015-08-18 Pierre Téchoueyres (tiny change) +2015-08-18 Pierre Téchoueyres (tiny change) * lisp/net/tramp-cmds.el (tramp-reporter-dump-variable): Encode/decode string. commit 877e77e3ee5da0926b7528d602addeec51709da0 Author: Eli Zaretskii Date: Sun Aug 23 18:01:35 2015 +0300 Support exec-directory with non-ASCII characters on Windows * src/w32proc.c (sys_spawnve): Make sure exec-directory is encoded in the system's ANSI codepage, when it is used for invoking cmdproxy. diff --git a/src/w32proc.c b/src/w32proc.c index d861ede..3aa8030 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -1813,13 +1813,21 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) cmdname = alloca (MAX_PATH); if (egetenv ("CMDPROXY")) - strcpy (cmdname, egetenv ("CMDPROXY")); + { + /* Implementation note: since process-environment, where + 'egetenv' looks, is encoded in the system codepage, we + don't need to encode the cmdproxy file name if we get it + from the environment. */ + strcpy (cmdname, egetenv ("CMDPROXY")); + } else { - char *q = lispstpcpy (cmdname, Vexec_directory); + char *q = lispstpcpy (cmdname, + /* exec-directory needs to be encoded. */ + ansi_encode_filename (Vexec_directory)); /* If we are run from the source tree, use cmdproxy.exe from the same source tree. */ - for (p = q - 2; p > cmdname; p--) + for (p = q - 2; p > cmdname; p = CharPrevA (cmdname, p)) if (*p == '/') break; if (*p == '/' && xstrcasecmp (p, "/lib-src/") == 0) commit 6b1765e05db432007ede6f1af3744e71063a728b Author: Andreas Schwab Date: Sun Aug 23 13:43:34 2015 +0200 Revert "Extend ‘format’ to translate curved quotes" This reverts commit 244c801689d2f7a80480d83cd7d092d4762ebe08. diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index ab1696e..ca8ae3f 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi @@ -347,11 +347,19 @@ and @samp{\=\=} puts @samp{\=} into the output. @strong{Please note:} Each @samp{\} must be doubled when written in a string in Emacs Lisp. +@defvar text-quoting-style @cindex curved quotes @cindex curly quotes -The value of the @code{text-quoting-style} variable specifies the style +The value of this variable specifies the style @code{substitute-command-keys} uses when generating left and right -quotes. @xref{Formatting Strings}, for more information. +quotes. If the variable's value is @code{curve}, the style is +@t{‘like this’} with curved single quotes. If the value is +@code{straight}, the style is @t{'like this'} with straight +apostrophes. If the value is @code{grave}, the style is @t{`like +this'} with grave accent and apostrophe. The default value @code{nil} +acts like @code{curve} if curved single quotes are displayable, and +like @code{grave} otherwise. +@end defvar @defun substitute-command-keys string This function scans @var{string} for the above special sequences and diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 8de1473..580eb43 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -805,27 +805,22 @@ formatting feature described here; they differ from @code{format} only in how they use the result of formatting. @defun format string &rest objects -This function returns a string that is equivalent to copying +This function returns a new string that is made by copying @var{string} and then replacing any format specification in the copy with encodings of the corresponding @var{objects}. The arguments @var{objects} are the computed values to be formatted. The characters in @var{string}, other than the format specifications, are copied directly into the output, including their text properties, -if any. If the output equals @var{string}, this function may return -@var{string} itself rather than a new copy. +if any. @end defun @cindex @samp{%} in format @cindex format specification -@cindex curved quotes -@cindex curly quotes A format specification is a sequence of characters beginning with a -@samp{%} or is a curved single quotation mark. Except for @samp{%%} -and quotation marks, each format specification says how to represent -one of the arguments @var{objects}. For example, if there -is a @samp{%d} in @var{string}, the @code{format} function replaces it -with the decimal representation of the integer to be formatted. +@samp{%}. Thus, if there is a @samp{%d} in @var{string}, the +@code{format} function replaces it with the printed representation of +one of the values to be formatted (one of the arguments @var{objects}). For example: @example @@ -835,12 +830,11 @@ For example: @end group @end example - Since @code{format} interprets @samp{%}, @samp{‘} and @samp{’} -characters as format + Since @code{format} interprets @samp{%} characters as format specifications, you should @emph{never} pass an arbitrary string as the first argument. This is particularly true when the string is generated by some Lisp code. Unless the string is @emph{known} to -never include any of the three special characters, pass @code{"%s"}, described +never include any @samp{%} characters, pass @code{"%s"}, described below, as the first argument, and the string as the second, like this: @example @@ -914,27 +908,17 @@ is shorter. Replace the specification with a single @samp{%}. This format specification is unusual in that it does not use a value. For example, @code{(format "%% %d" 30)} returns @code{"% 30"}. - -@item ‘ -@itemx ’ -@cindex curved quotes -@cindex curly quotes -Replace the specification with a left or right quote, respectively. -Although typically a curved single quotation mark stands for itself, -other quoting styles are available as per the variable -@samp{text-quoting-style} described below. @end table - Any other format character after @samp{%} results in an @samp{Invalid format + Any other format character results in an @samp{Invalid format operation} error. - Here are several examples, which assume the typical quoting style -where curved single quotes stand for themselves: + Here are several examples: @example @group -(format "The name of this buffer is ‘%s’." (buffer-name)) - @result{} "The name of this buffer is ‘strings.texi’." +(format "The name of this buffer is %s." (buffer-name)) + @result{} "The name of this buffer is strings.texi." (format "The buffer object prints as %qs." (current-buffer)) @result{} "The buffer object prints as ‘strings.texi’." @@ -948,7 +932,7 @@ where curved single quotes stand for themselves: @cindex field width @cindex padding - A @samp{%} specification can have a @dfn{width}, which is a decimal number + A specification can have a @dfn{width}, which is a decimal number between the @samp{%} and the specification character. If the printed representation of the object contains fewer characters than this width, @code{format} extends it with padding. The width specifier is @@ -964,7 +948,7 @@ the width specifier normally consists of spaces inserted on the left: If the width is too small, @code{format} does not truncate the object's printed representation. Thus, you can use a width to specify a minimum spacing between columns with no risk of losing information. -In the following two examples, @samp{%7s} specifies a minimum width +In the following three examples, @samp{%7s} specifies a minimum width of 7. In the first case, the string inserted in place of @samp{%7s} has only 3 letters, and needs 4 blank spaces as padding. In the second case, the string @code{"specification"} is 13 letters wide but @@ -972,12 +956,12 @@ is not truncated. @example @group -(format "The word ‘%7s’ has %d letters in it." +(format "The word '%7s' has %d letters in it." "foo" (length "foo")) - @result{} "The word ‘ foo’ has 3 letters in it." -(format "The word ‘%7s’ has %d letters in it." + @result{} "The word ' foo' has 3 letters in it." +(format "The word '%7s' has %d letters in it." "specification" (length "specification")) - @result{} "The word ‘specification’ has 13 letters in it." + @result{} "The word 'specification' has 13 letters in it." @end group @end example @@ -1022,14 +1006,14 @@ variable @samp{text-quoting-style} described below. (format "%q-6d is padded on the right" 123) @result{} "‘123 ’ is padded on the right" -(format "The word ‘%-7s’ actually has %d letters in it." +(format "The word '%-7s' actually has %d letters in it." "foo" (length "foo")) - @result{} "The word ‘foo ’ actually has 3 letters in it." + @result{} "The word 'foo ' actually has 3 letters in it." @end group @end example @cindex precision in format specifications - The @samp{%} specification characters allow an optional @dfn{precision} + All the specification characters allow an optional @dfn{precision} before the character (after the width, if present). The precision is a decimal-point @samp{.} followed by a digit-string. For the floating-point specifications (@samp{%e}, @samp{%f}, @samp{%g}), the @@ -1040,19 +1024,6 @@ shows only the first three characters of the representation for @var{object}. Precision has no effect for other specification characters. -@defvar text-quoting-style -@cindex curved quotes -@cindex curly quotes -This variable specifies the style @code{format} uses when generating -left and right quotes. If the value is @code{curve}, the style is -@t{‘like this’} with curved single quotes. If the value is -@code{straight}, the style is @t{'like this'} with straight -apostrophes. If the value is @code{grave}, the style is @t{`like -this'} with grave accent and apostrophe. The default value @code{nil} -acts like @code{curve} if curved single quotes are displayable, and -like @code{grave} otherwise. -@end defvar - @node Case Conversion @section Case Conversion in Lisp @cindex upper case diff --git a/etc/NEWS b/etc/NEWS index 72af95e..d3a01c2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -910,19 +910,6 @@ denied" instead of "permission denied". The old behavior was problematic in languages like German where downcasing rules depend on grammar. +++ -** ‘format’ now replaces curved single quotes. -That is, it replaces strings' curved single quotes (also known as -curly quotes) as per the value of the new custom variable -‘text-quoting-style’: ‘curve’ means replace curved quotes with -themselves ‘like this’, ‘straight’ means use straight apostrophes -'like this', ‘grave’ means use grave accent and apostrophe `like -this', and nil (default) means use curved quotes if displayable and -grave accent and apostrophe otherwise. Because it now may be used -in many contexts where it's a no-op, ‘format’ is no longer required to -create a string, and may return its first argument if the argument -already has the correct value. - -+++ ** New ‘format’ flag ‘q’ The new ‘q’ flag causes ‘format’ to quote the output representation as per the value of ‘text quoting-style’. E.g., (format "%qs failed" diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el index 01ab495..50a0291 100644 --- a/lisp/calc/calc-help.el +++ b/lisp/calc/calc-help.el @@ -365,7 +365,7 @@ C-w Describe how there is no warranty for Calc." (let (Info-history) (Info-goto-node (buffer-substring (match-beginning 1) (match-end 1)))) (let* ((string-target (or target thing)) - (quoted (concat "['`‘]" (regexp-quote string-target) "['’]")) + (quoted (format "['`‘]%s['’]" (regexp-quote string-target))) (bracketed (format "\\[%s\\]\\|(%s)\\|\\" makeinfo can append diff --git a/src/editfns.c b/src/editfns.c index 0e1b0c8..8ac0ef1 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3800,9 +3800,8 @@ DEFUN ("format", Fformat, Sformat, 1, MANY, 0, The first argument is a format control string. The other arguments are substituted into it to make the result, a string. -The format control string may contain ordinary characters, -%-sequences meaning to substitute the next available argument, -and curved single quotation marks meaning to substitute quotes. +The format control string may contain %-sequences meaning to substitute +the next available argument: %s means print a string argument. Actually, prints any object, with `princ'. %d means print as number in decimal (%o octal, %x hex). @@ -3850,12 +3849,6 @@ precision specifier says how many decimal places to show; if zero, the decimal point itself is omitted. For %s and %S, the precision specifier truncates the string to the given width. -\\=‘ and \\=’ means print left and right quotes as per -‘text-quoting-style’. - -Return the first argument if it contains no format directives. -Otherwise, return a new string. - usage: (format STRING &rest OBJECTS) */) (ptrdiff_t nargs, Lisp_Object *args) { @@ -3868,7 +3861,6 @@ usage: (format STRING &rest OBJECTS) */) ptrdiff_t buf_save_value_index IF_LINT (= 0); char *format, *end, *format_start; ptrdiff_t formatlen, nchars; - bool changed = false; /* True if the format is multibyte. */ bool multibyte_format = 0; /* True if the output should be a multibyte string, @@ -4020,7 +4012,6 @@ usage: (format STRING &rest OBJECTS) */) if (format == end) error ("Format string ends in middle of format specifier"); - changed = true; memset (&discarded[format0 - format_start], 1, format - format0); conversion = *format; if (conversion == '%') @@ -4493,20 +4484,6 @@ usage: (format STRING &rest OBJECTS) */) convbytes = format - src; memset (&discarded[src + 1 - format_start], 2, convbytes - 1); - - if (quoting_style != CURVE_QUOTING_STYLE && convbytes == 3 - && (unsigned char) src[0] == uLSQM0 - && (unsigned char) src[1] == uLSQM1 - && ((unsigned char) src[2] == uLSQM2 - || (unsigned char) src[2] == uRSQM2)) - { - convbytes = 1; - str[0] = (((unsigned char) src[2] == uLSQM2 - && quoting_style == GRAVE_QUOTING_STYLE) - ? '`' : '\''); - src = (char *) str; - changed = true; - } } else { @@ -4518,7 +4495,6 @@ usage: (format STRING &rest OBJECTS) */) int c = BYTE8_TO_CHAR (uc); convbytes = CHAR_STRING (c, str); src = (char *) str; - changed = true; } } @@ -4566,119 +4542,113 @@ usage: (format STRING &rest OBJECTS) */) if (bufsize < p - buf) emacs_abort (); - if (!changed) - val = args[0]; - else - { - if (maybe_combine_byte) - nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf); - val = make_specified_string (buf, nchars, p - buf, multibyte); + if (maybe_combine_byte) + nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf); + val = make_specified_string (buf, nchars, p - buf, multibyte); - /* If the format string has text properties, or any of the string - arguments has text properties, set up text properties of the - result string. */ + /* If the format string has text properties, or any of the string + arguments has text properties, set up text properties of the + result string. */ - if (string_intervals (args[0]) || arg_intervals) - { - Lisp_Object len, new_len, props; - struct gcpro gcpro1; + if (string_intervals (args[0]) || arg_intervals) + { + Lisp_Object len, new_len, props; + struct gcpro gcpro1; - /* Add text properties from the format string. */ - len = make_number (SCHARS (args[0])); - props = text_property_list (args[0], make_number (0), len, Qnil); - GCPRO1 (props); + /* Add text properties from the format string. */ + len = make_number (SCHARS (args[0])); + props = text_property_list (args[0], make_number (0), len, Qnil); + GCPRO1 (props); - if (CONSP (props)) + if (CONSP (props)) + { + ptrdiff_t bytepos = 0, position = 0, translated = 0; + ptrdiff_t argn = 1; + Lisp_Object list; + + /* Adjust the bounds of each text property + to the proper start and end in the output string. */ + + /* Put the positions in PROPS in increasing order, so that + we can do (effectively) one scan through the position + space of the format string. */ + props = Fnreverse (props); + + /* BYTEPOS is the byte position in the format string, + POSITION is the untranslated char position in it, + TRANSLATED is the translated char position in BUF, + and ARGN is the number of the next arg we will come to. */ + for (list = props; CONSP (list); list = XCDR (list)) { - ptrdiff_t bytepos = 0, position = 0, translated = 0; - ptrdiff_t argn = 1; - Lisp_Object list; - - /* Adjust the bounds of each text property - to the proper start and end in the output string. */ - - /* Put the positions in PROPS in increasing order, so that - we can do (effectively) one scan through the position - space of the format string. */ - props = Fnreverse (props); - - /* BYTEPOS is the byte position in the format string, - POSITION is the untranslated char position in it, - TRANSLATED is the translated char position in BUF, - and ARGN is the number of the next arg we will come to. */ - for (list = props; CONSP (list); list = XCDR (list)) - { - Lisp_Object item; - ptrdiff_t pos; + Lisp_Object item; + ptrdiff_t pos; - item = XCAR (list); + item = XCAR (list); - /* First adjust the property start position. */ - pos = XINT (XCAR (item)); + /* First adjust the property start position. */ + pos = XINT (XCAR (item)); - /* Advance BYTEPOS, POSITION, TRANSLATED and ARGN - up to this position. */ - for (; position < pos; bytepos++) + /* Advance BYTEPOS, POSITION, TRANSLATED and ARGN + up to this position. */ + for (; position < pos; bytepos++) + { + if (! discarded[bytepos]) + position++, translated++; + else if (discarded[bytepos] == 1) { - if (! discarded[bytepos]) - position++, translated++; - else if (discarded[bytepos] == 1) + position++; + if (translated == info[argn].start) { - position++; - if (translated == info[argn].start) - { - translated += info[argn].end - info[argn].start; - argn++; - } + translated += info[argn].end - info[argn].start; + argn++; } } + } - XSETCAR (item, make_number (translated)); + XSETCAR (item, make_number (translated)); - /* Likewise adjust the property end position. */ - pos = XINT (XCAR (XCDR (item))); + /* Likewise adjust the property end position. */ + pos = XINT (XCAR (XCDR (item))); - for (; position < pos; bytepos++) + for (; position < pos; bytepos++) + { + if (! discarded[bytepos]) + position++, translated++; + else if (discarded[bytepos] == 1) { - if (! discarded[bytepos]) - position++, translated++; - else if (discarded[bytepos] == 1) + position++; + if (translated == info[argn].start) { - position++; - if (translated == info[argn].start) - { - translated += info[argn].end - info[argn].start; - argn++; - } + translated += info[argn].end - info[argn].start; + argn++; } } - - XSETCAR (XCDR (item), make_number (translated)); } - add_text_properties_from_list (val, props, make_number (0)); + XSETCAR (XCDR (item), make_number (translated)); } - /* Add text properties from arguments. */ - if (arg_intervals) - for (n = 1; n < nargs; ++n) - if (info[n].intervals) - { - len = make_number (SCHARS (args[n])); - new_len = make_number (info[n].end - info[n].start); - props = text_property_list (args[n], make_number (0), - len, Qnil); - props = extend_property_ranges (props, new_len); - /* If successive arguments have properties, be sure that - the value of `composition' property be the copy. */ - if (n > 1 && info[n - 1].end) - make_composition_value_copy (props); - add_text_properties_from_list (val, props, - make_number (info[n].start)); - } - - UNGCPRO; + add_text_properties_from_list (val, props, make_number (0)); } + + /* Add text properties from arguments. */ + if (arg_intervals) + for (n = 1; n < nargs; ++n) + if (info[n].intervals) + { + len = make_number (SCHARS (args[n])); + new_len = make_number (info[n].end - info[n].start); + props = text_property_list (args[n], make_number (0), len, Qnil); + props = extend_property_ranges (props, new_len); + /* If successive arguments have properties, be sure that + the value of `composition' property be the copy. */ + if (n > 1 && info[n - 1].end) + make_composition_value_copy (props); + add_text_properties_from_list (val, props, + make_number (info[n].start)); + } + + UNGCPRO; } /* If we allocated BUF or INFO with malloc, free it too. */ commit 0b0c9565d050bfecc581b342c40b719917395896 Author: Andreas Schwab Date: Sun Aug 23 13:42:04 2015 +0200 Revert "Prefer ‘format’ to ‘substitute-command-keys’" This reverts commit 6af5aad26411ffe21c3fe4bc5438347110910111. diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index aa1dd65..3bdc3ea 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -629,9 +629,10 @@ SYMBOL is a function that can be overridden." (defun mode-local-print-binding (symbol) "Print the SYMBOL binding." (let ((value (symbol-value symbol))) - (princ (format "\n ‘%s’ value is\n " symbol)) + (princ (format (substitute-command-keys "\n ‘%s’ value is\n ") + symbol)) (if (and value (symbolp value)) - (princ (format "‘%s’" value)) + (princ (format (substitute-command-keys "‘%s’") value)) (let ((pt (point))) (pp value) (save-excursion @@ -689,7 +690,7 @@ SYMBOL is a function that can be overridden." ) ((symbolp buffer-or-mode) (setq mode buffer-or-mode) - (princ (format "‘%s’\n" buffer-or-mode)) + (princ (format (substitute-command-keys "‘%s’\n") buffer-or-mode)) ) ((signal 'wrong-type-argument (list 'buffer-or-mode buffer-or-mode)))) @@ -699,7 +700,7 @@ SYMBOL is a function that can be overridden." (while mode (setq table (get mode 'mode-local-symbol-table)) (when table - (princ (format "\n- From ‘%s’\n" mode)) + (princ (format (substitute-command-keys "\n- From ‘%s’\n") mode)) (mode-local-print-bindings table)) (setq mode (get-mode-local-parent mode))))) diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el index efcfe4b..48f0555 100644 --- a/lisp/cedet/srecode/srt-mode.el +++ b/lisp/cedet/srecode/srt-mode.el @@ -258,9 +258,9 @@ we can tell font lock about them.") (when (class-abstract-p C) (throw 'skip nil)) - (princ (format "‘")) + (princ (substitute-command-keys "‘")) (princ name) - (princ (format "’")) + (princ (substitute-command-keys "’")) (when (slot-exists-p C 'key) (when key (princ " - Character Key: ") diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el index f8e5650..bc221e1 100644 --- a/lisp/cus-theme.el +++ b/lisp/cus-theme.el @@ -492,10 +492,10 @@ It includes all faces in list FACES." '("" "c"))) doc) (when fn - (princ (format " in ‘")) + (princ (substitute-command-keys " in ‘")) (help-insert-xref-button (file-name-nondirectory fn) 'help-theme-def fn) - (princ (format "’"))) + (princ (substitute-command-keys "’"))) (princ ".\n") (if (custom-theme-p theme) (progn diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 579278c..71233d4 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el @@ -161,8 +161,11 @@ otherwise." ;; Buttons (when (and button (not (widgetp wid-button))) (newline) - (insert (format "Here is a ‘%S’ button labeled ‘%s’.\n\n" - button-type button-label))) + (insert (substitute-command-keys "Here is a ‘") + (format "%S" button-type) + (substitute-command-keys "’ button labeled ‘") + button-label + (substitute-command-keys "’.\n\n"))) ;; Overlays (when overlays (newline) @@ -736,7 +739,9 @@ relevant to POS." (when face (insert (propertize " " 'display '(space :align-to 5)) "face: ") - (insert (format "‘%s’\n" face)))))) + (insert (substitute-command-keys "‘") + (symbol-name face) + (substitute-command-keys "’\n")))))) (insert "these terminal codes:\n") (dotimes (i (length disp-vector)) (insert (car (aref disp-vector i)) diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 6f436db..8ed50f4 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -752,16 +752,16 @@ including `cl-block' and `cl-eval-when'." ;; FIXME: Add a `cl-class-of' or `cl-typeof' or somesuch. (metatype (cl--class-name (symbol-value (aref class 0))))) (insert (symbol-name type) - (format " is a type (of kind ‘")) + (substitute-command-keys " is a type (of kind ‘")) (help-insert-xref-button (symbol-name metatype) 'cl-help-type metatype) - (insert (format "’)")) + (insert (substitute-command-keys "’)")) (when location - (insert (format " in ‘")) + (insert (substitute-command-keys " in ‘")) (help-insert-xref-button (help-fns-short-filename location) 'cl-type-definition type location 'define-type) - (insert (format "’"))) + (insert (substitute-command-keys "’"))) (insert ".\n") ;; Parents. @@ -771,10 +771,10 @@ including `cl-block' and `cl-eval-when'." (insert " Inherits from ") (while (setq cur (pop pl)) (setq cur (cl--class-name cur)) - (insert (format "‘")) + (insert (substitute-command-keys "‘")) (help-insert-xref-button (symbol-name cur) 'cl-help-type cur) - (insert (format (if pl "’, " "’")))) + (insert (substitute-command-keys (if pl "’, " "’")))) (insert ".\n"))) ;; Children, if available. ¡For EIEIO! @@ -785,10 +785,10 @@ including `cl-block' and `cl-eval-when'." (when ch (insert " Children ") (while (setq cur (pop ch)) - (insert (format "‘")) + (insert (substitute-command-keys "‘")) (help-insert-xref-button (symbol-name cur) 'cl-help-type cur) - (insert (format (if ch "’, " "’")))) + (insert (substitute-command-keys (if ch "’, " "’")))) (insert ".\n"))) ;; Type's documentation. @@ -804,10 +804,10 @@ including `cl-block' and `cl-eval-when'." (when generics (insert (propertize "Specialized Methods:\n\n" 'face 'bold)) (dolist (generic generics) - (insert (format "‘")) + (insert (substitute-command-keys "‘")) (help-insert-xref-button (symbol-name generic) 'help-function generic) - (insert (format "’")) + (insert (substitute-command-keys "’")) (pcase-dolist (`(,qualifiers ,args ,doc) (cl--generic-method-documentation generic type)) (insert (format " %s%S\n" qualifiers args) diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index cecd737..5d52761 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -864,11 +864,11 @@ MET-NAME is a cons (SYMBOL . SPECIALIZERS)." (cl--generic-method-specializers method))) (file (find-lisp-object-file-name met-name 'cl-defmethod))) (when file - (insert (format " in ‘")) + (insert (substitute-command-keys " in ‘")) (help-insert-xref-button (help-fns-short-filename file) 'help-function-def met-name file 'cl-defmethod) - (insert (format "’.\n")))) + (insert (substitute-command-keys "’.\n")))) (insert "\n" (or (nth 2 info) "Undocumented") "\n\n"))))))) (defun cl--generic-specializers-apply-to-type-p (specializers type) diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el index c4d6d35..0b00336 100644 --- a/lisp/emacs-lisp/eieio-opt.el +++ b/lisp/emacs-lisp/eieio-opt.el @@ -141,11 +141,11 @@ are not abstract." (setq location (find-lisp-object-file-name ctr def))) (when location - (insert (format " in ‘")) + (insert (substitute-command-keys " in ‘")) (help-insert-xref-button (help-fns-short-filename location) 'cl-type-definition ctr location 'define-type) - (insert (format "’"))) + (insert (substitute-command-keys "’"))) (insert ".\nCreates an object of class " (symbol-name ctr) ".") (goto-char (point-max)) (if (autoloadp def) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index f7cd6a1..3d2dbdf 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2204,7 +2204,7 @@ Otherwise no newline is inserted." "Installed" (capitalize status)) 'font-lock-face 'package-status-builtin-face)) - (insert (format " in ‘")) + (insert (substitute-command-keys " in ‘")) (let ((dir (abbreviate-file-name (file-name-as-directory (if (file-in-directory-p pkg-dir package-user-dir) @@ -2213,10 +2213,11 @@ Otherwise no newline is inserted." (help-insert-xref-button dir 'help-package-def pkg-dir)) (if (and (package-built-in-p name) (not (package-built-in-p name version))) - (insert (format "’,\n shadowing a ") + (insert (substitute-command-keys + "’,\n shadowing a ") (propertize "built-in package" 'font-lock-face 'package-status-builtin-face)) - (insert (format "’"))) + (insert (substitute-command-keys "’"))) (if signed (insert ".") (insert " (unsigned).")) diff --git a/lisp/faces.el b/lisp/faces.el index 15ed699..e628ee7 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1436,10 +1436,12 @@ If FRAME is omitted or nil, use the selected frame." (when alias (setq face alias) (insert - (format "\n %s is an alias for the face ‘%s’.\n%s" + (format (substitute-command-keys + "\n %s is an alias for the face ‘%s’.\n%s") f alias (if (setq obsolete (get f 'obsolete-face)) - (format " This face is obsolete%s; use ‘%s’ instead.\n" + (format (substitute-command-keys + " This face is obsolete%s; use ‘%s’ instead.\n") (if (stringp obsolete) (format " since %s" obsolete) "") @@ -1457,11 +1459,13 @@ If FRAME is omitted or nil, use the selected frame." (help-xref-button 1 'help-customize-face f))) (setq file-name (find-lisp-object-file-name f 'defface)) (when file-name - (princ (format "Defined in ‘%s’" - (file-name-nondirectory file-name))) + (princ (substitute-command-keys "Defined in ‘")) + (princ (file-name-nondirectory file-name)) + (princ (substitute-command-keys "’")) ;; Make a hyperlink to the library. (save-excursion - (re-search-backward (format "‘\\([^‘’]+\\)’") nil t) + (re-search-backward + (substitute-command-keys "‘\\([^‘’]+\\)’") nil t) (help-xref-button 1 'help-face-def f file-name)) (princ ".") (terpri) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 8ed9a47..afd09ca 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -319,7 +319,9 @@ suitable file is found, return nil." (when remapped (princ "Its keys are remapped to ") (princ (if (symbolp remapped) - (format "‘%s’" remapped) + (concat (substitute-command-keys "‘") + (symbol-name remapped) + (substitute-command-keys "’")) "an anonymous command")) (princ ".\n")) @@ -353,16 +355,18 @@ suitable file is found, return nil." (insert "\nThis function has a compiler macro") (if (symbolp handler) (progn - (insert (format " ‘%s’" handler)) + (insert (format (substitute-command-keys " ‘%s’") handler)) (save-excursion - (re-search-backward (format "‘\\([^‘’]+\\)’") nil t) + (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’") + nil t) (help-xref-button 1 'help-function handler))) ;; FIXME: Obsolete since 24.4. (let ((lib (get function 'compiler-macro-file))) (when (stringp lib) - (insert (format " in ‘%s’" lib)) + (insert (format (substitute-command-keys " in ‘%s’") lib)) (save-excursion - (re-search-backward (format "‘\\([^‘’]+\\)’") nil t) + (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’") + nil t) (help-xref-button 1 'help-function-cmacro function lib))))) (insert ".\n")))) @@ -417,13 +421,13 @@ suitable file is found, return nil." (get function 'derived-mode-parent)))) (when parent-mode - (insert (format "\nParent mode: ‘")) + (insert (substitute-command-keys "\nParent mode: ‘")) (let ((beg (point))) (insert (format "%s" parent-mode)) (make-text-button beg (point) 'type 'help-function 'help-args (list parent-mode))) - (insert (format "’.\n"))))) + (insert (substitute-command-keys "’.\n"))))) (defun help-fns--obsolete (function) ;; Ignore lambda constructs, keyboard macros, etc. @@ -438,9 +442,10 @@ suitable file is found, return nil." " is obsolete") (when (nth 2 obsolete) (insert (format " since %s" (nth 2 obsolete)))) - (insert (cond ((stringp use) - (concat ";\n" (substitute-command-keys use))) - (use (format ";\nuse ‘%s’ instead." use)) + (insert (cond ((stringp use) (concat ";\n" use)) + (use (format (substitute-command-keys + ";\nuse ‘%s’ instead.") + use)) (t ".")) "\n")))) @@ -476,7 +481,8 @@ FILE is the file where FUNCTION was probably defined." (format ";\nin Lisp code %s" interactive-only)) ((and (symbolp 'interactive-only) (not (eq interactive-only t))) - (format ";\nin Lisp code use ‘%s’ instead." + (format (substitute-command-keys + ";\nin Lisp code use ‘%s’ instead.") interactive-only)) (t ".")) "\n"))))) @@ -545,7 +551,8 @@ FILE is the file where FUNCTION was probably defined." ;; Aliases are Lisp functions, so we need to check ;; aliases before functions. (aliased - (format "an alias for ‘%s’" real-def)) + (format (substitute-command-keys "an alias for ‘%s’") + real-def)) ((autoloadp def) (format "%s autoloaded %s" (if (commandp def) "an interactive" "an") @@ -579,22 +586,24 @@ FILE is the file where FUNCTION was probably defined." (with-current-buffer standard-output (save-excursion (save-match-data - (when (re-search-backward (format "alias for ‘\\([^‘’]+\\)’") + (when (re-search-backward (substitute-command-keys + "alias for ‘\\([^‘’]+\\)’") nil t) (help-xref-button 1 'help-function real-def))))) (when file-name - (princ (format " in ‘")) + (princ (substitute-command-keys " in ‘")) ;; We used to add .el to the file name, ;; but that's completely wrong when the user used load-file. (princ (if (eq file-name 'C-source) "C source code" (help-fns-short-filename file-name))) - (princ (format "’")) + (princ (substitute-command-keys "’")) ;; Make a hyperlink to the library. (with-current-buffer standard-output (save-excursion - (re-search-backward (format "‘\\([^‘’]+\\)’") nil t) + (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’") + nil t) (help-xref-button 1 'help-function-def function file-name)))) (princ ".") (with-current-buffer (help-buffer) @@ -727,14 +736,17 @@ it is displayed along with the global value." (if file-name (progn - (princ (format " is a variable defined in ‘")) + (princ (substitute-command-keys + " is a variable defined in ‘")) (princ (if (eq file-name 'C-source) "C source code" (file-name-nondirectory file-name))) - (princ (format "’.\n")) + (princ (substitute-command-keys "’.\n")) (with-current-buffer standard-output (save-excursion - (re-search-backward (format "‘\\([^‘’]+\\)’") nil t) + (re-search-backward (substitute-command-keys + "‘\\([^‘’]+\\)’") + nil t) (help-xref-button 1 'help-variable-def variable file-name))) (if valvoid @@ -864,7 +876,8 @@ if it is given a local binding.\n"))) ;; Mention if it's an alias. (unless (eq alias variable) (setq extra-line t) - (princ (format " This variable is an alias for ‘%s’.\n" + (princ (format (substitute-command-keys + " This variable is an alias for ‘%s’.\n") alias))) (when obsolete @@ -872,9 +885,9 @@ if it is given a local binding.\n"))) (princ " This variable is obsolete") (if (nth 2 obsolete) (princ (format " since %s" (nth 2 obsolete)))) - (princ (cond ((stringp use) - (concat ";\n " (substitute-command-keys use))) - (use (format ";\n use ‘%s’ instead." + (princ (cond ((stringp use) (concat ";\n " use)) + (use (format (substitute-command-keys + ";\n use ‘%s’ instead.") (car obsolete))) (t "."))) (terpri)) @@ -905,7 +918,7 @@ if it is given a local binding.\n"))) ;; Otherwise, assume it was set directly. (setq file (car file) dir-file nil))) - (princ (format + (princ (substitute-command-keys (if dir-file "by the file\n ‘" "for the directory\n ‘"))) @@ -913,7 +926,7 @@ if it is given a local binding.\n"))) (insert-text-button file 'type 'help-dir-local-var-def 'help-args (list variable file))) - (princ (format "’.\n")))) + (princ (substitute-command-keys "’.\n")))) (princ " This variable's value is file-local.\n"))) (when (memq variable ignored-local-variables) @@ -937,7 +950,8 @@ file-local variable.\n") (princ "if its value\n satisfies the predicate ") (princ (if (byte-code-function-p safe-var) "which is a byte-compiled expression.\n" - (format "‘%s’.\n" safe-var)))) + (format (substitute-command-keys "‘%s’.\n") + safe-var)))) (if extra-line (terpri)) (princ "Documentation:\n") diff --git a/lisp/help.el b/lisp/help.el index a8991b5..db87d58 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -964,12 +964,14 @@ documentation for the major and minor modes of that buffer." (let* ((mode major-mode) (file-name (find-lisp-object-file-name mode nil))) (when file-name - (princ (format " defined in ‘%s’" - (file-name-nondirectory file-name))) + (princ (concat (substitute-command-keys " defined in ‘") + (file-name-nondirectory file-name) + (substitute-command-keys "’"))) ;; Make a hyperlink to the library. (with-current-buffer standard-output (save-excursion - (re-search-backward (format "‘\\([^‘’]+\\)’") nil t) + (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’") + nil t) (help-xref-button 1 'help-function-def mode file-name))))) (princ ":\n") (princ (documentation major-mode))))) diff --git a/src/doc.c b/src/doc.c index 9c9bdf3..f871ac7 100644 --- a/src/doc.c +++ b/src/doc.c @@ -927,13 +927,14 @@ Otherwise, return a new string. */) if (NILP (tem)) { name = Fsymbol_name (name); - insert1 (CALLN (Fformat, build_string ("\nUses keymap "uLSQM))); + insert1 (Fsubstitute_command_keys + (build_string ("\nUses keymap "uLSQM))); insert_from_string (name, 0, 0, SCHARS (name), SBYTES (name), 1); - insert1 (CALLN (Fformat, - (build_string - (uRSQM", which is not currently defined.\n")))); + insert1 (Fsubstitute_command_keys + (build_string + (uRSQM", which is not currently defined.\n"))); if (start[-1] == '<') keymap = Qnil; } else if (start[-1] == '<') diff --git a/src/syntax.c b/src/syntax.c index 30560af..d45936b 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -1333,11 +1333,9 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, insert_string (" (nestable)"); if (prefix) - { - AUTO_STRING (prefixdoc, - ",\n\t is a prefix character for `backward-prefix-chars'"); - insert1 (Fsubstitute_command_keys (prefixdoc)); - } + insert1 (Fsubstitute_command_keys + (build_string + (",\n\t is a prefix character for `backward-prefix-chars'"))); return syntax; } commit 70ff62413a17cbe5a4f218202a6a91c38d86c8c8 Author: Xue Fuqiao Date: Sun Aug 23 19:45:54 2015 +0800 ; * doc/lispintro/emacs-lisp-intro.texi (Buffer Size & Locations): ; Markup fix. ("point" is not a variable, so "@code{point}" should ; be either "point" or @code{(point)} here.) diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index a9f02f5..40abc44 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -2909,7 +2909,7 @@ the following expression in the usual way: @end smallexample @noindent -As I write this, the value of @code{point} is 65724. The @code{point} +As I write this, the value of point is 65724. The @code{point} function is frequently used in some of the examples later in this book. commit ef00774df4582592ac675fbe803ecc887e0e248a Author: Xue Fuqiao Date: Sun Aug 23 19:21:33 2015 +0800 * doc/lispintro/emacs-lisp-intro.texi (Switching Buffers): Clarify "invisible window". diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 183e68f..a9f02f5 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -2840,10 +2840,10 @@ following more complex expression: @c noindent In this case, the first argument to @code{other-buffer} tells it which buffer to skip---the current one---and the second argument tells -@code{other-buffer} it is OK to switch to a visible buffer. -In regular use, @code{switch-to-buffer} takes you to an invisible -window since you would most likely use @kbd{C-x o} (@code{other-window}) -to go to another visible buffer.} +@code{other-buffer} it is OK to switch to a visible buffer. In +regular use, @code{switch-to-buffer} takes you to a buffer not visible +in windows since you would most likely use @kbd{C-x o} +(@code{other-window}) to go to another visible buffer.} In the programming examples in later sections of this document, you will see the function @code{set-buffer} more often than commit 2f0d41ea4fd47bbc53a53d7634869b21cf03c1a0 Author: Glenn Morris Date: Sun Aug 23 06:24:06 2015 -0400 ; Auto-commit of ChangeLog files. diff --git a/ChangeLog.2 b/ChangeLog.2 index 242cf6b..2da3e73 100644 --- a/ChangeLog.2 +++ b/ChangeLog.2 @@ -1,3 +1,1031 @@ +2015-08-23 Xue Fuqiao + + * doc/emacs/modes.texi (Choosing Modes): Minor doc fix for + magic-fallback-mode-alist. + +2015-08-22 Fabián Ezequiel Gallina + + python.el: fallback completion, ffap and eldoc setup enhancements + Setup codes are now sent continuously so that the current frame is + always taken into account. This allows working within debuggers + and always keeping a fresh version of setup codes that will return + proper results. + * lisp/progmodes/python.el (python-shell-setup-codes): Cleanup. + (python-shell-send-setup-code): Send code only when + python-shell-setup-codes is non-nil. + (python-shell-completion-string-code): Cleanup trailing newline. + (python-shell-completion-get-completions): Always use + python-shell-completion-setup-code. + (python-ffap-setup-code): Work with any object, not only modules. + (python-ffap-string-code): Cleanup trailing newline. + (python-ffap-module-path): Always use python-ffap-setup-code. + (python-eldoc-string-code): Cleanup trailing newline. + (python-eldoc--get-doc-at-point): Always use + python-eldoc-setup-code. Return non-nil only if docstring is + found. + + python.el: Increase native completion robustness. + * lisp/progmodes/python.el (python-shell-completion-native-setup): + Make completer print real candidates and just return dummy ones to + avoid input modification. + (python-shell-completion-native-get-completions): Set + comint-redirect-insert-matching-regexp to non-nil and make + comint-redirect-finished-regexp match the last dummy candidate. + Use python-shell-accept-process-output to wait for the full list + of candidates. + +2015-08-22 Eli Zaretskii + + Fix invocation of programs via cmdproxy.exe + * src/w32proc.c (sys_spawnve): Use exec-directory, not + invocation-directory, for finding cmdproxy.exe. When Emacs is + run from the source tree, look for cmdproxy.exe in the same source + tree. (Bug#21323) + +2015-08-22 Simen Heggestøyl + + Handle comments inside unquoted URIs in css-mode + * lisp/textmodes/css-mode.el (css--uri-re): New defconst. + (css-syntax-propertize-function): New defconst. + (css--font-lock-keywords): Handle parens around unquoted URIs. + (css-mode): Set `syntax-propertize-function'. + +2015-08-22 Eli Zaretskii + + Support invocation of Hunspell with multiple dictionaries + * lisp/textmodes/ispell.el (ispell-parse-hunspell-affix-file): Support + lists of dictionaries of the form "DICT1,DICT2,...". + (ispell-hunspell-add-multi-dic): New command. (Bug#20495) + + Minor formatting changes in ispell.el + * lisp/textmodes/ispell.el (ispell-create-debug-buffer) + (ispell-print-if-debug, ispell-aspell-find-dictionary) + (ispell-aspell-add-aliases, ispell-hunspell-dict-paths-alist) + (ispell-hunspell-dictionary-alist) + (ispell-hunspell-fill-dictionary-entry) + (ispell-find-hunspell-dictionaries, ispell-send-replacement) + (ispell-buffer-with-debug, ispell-complete-word) + (ispell-current-dictionary, ispell-current-personal-dictionary) + (ispell-accept-output, ispell-minor-mode) + (ispell-personal-dictionary, ispell-dictionary-alist) + (ispell-really-aspell, ispell-really-hunspell) + (ispell-encoding8-command, ispell-aspell-supports-utf8) + (ispell-aspell-dictionary-alist, ispell-set-spellchecker-params): + Fix whitespace, inconsistent capitalization, and arguments in doc + strings. + +2015-08-22 Martin Rudalics + + In ‘adjust-window-trailing-edge’ fix bug with size-preserved windows. + * lisp/window.el (adjust-window-trailing-edge): Fix bug where this + function refused to resize a size-preserved window. + +2015-08-22 Eli Zaretskii + + Improve documentation of 'window-use-time' + * doc/lispref/windows.texi (Selecting Windows): Improve + documentation and indexing of 'window-use-time'. + +2015-08-21 Stefan Monnier + + * lisp/progmodes/cc-*.el: Fix up commenting style + * lisp/progmodes/cc-vars.el, lisp/progmodes/cc-styles.el: + * lisp/progmodes/cc-mode.el, lisp/progmodes/cc-menus.el: + * lisp/progmodes/cc-langs.el, lisp/progmodes/cc-guess.el: + * lisp/progmodes/cc-fonts.el, lisp/progmodes/cc-engine.el: + * lisp/progmodes/cc-defs.el, lisp/progmodes/cc-cmds.el: + * lisp/progmodes/cc-bytecomp.el, lisp/progmodes/cc-awk.el: + * lisp/progmodes/cc-align.el, lisp/net/soap-client.el: + Fix up commenting style. + +2015-08-21 Paul Eggert + + text-quoting-style in emacs-lisp diagnostics + * lisp/emacs-lisp/advice.el (ad-read-advised-function) + (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) + (ad-disable-advice, ad-remove-advice, ad-set-argument) + (ad-set-arguments): + * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) + (byte-compile-unfold-lambda, byte-optimize-form-code-walker) + (byte-optimize-while, byte-optimize-apply): + * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) + (byte-compile-log-file, byte-compile-format-warn) + (byte-compile-nogroup-warn, byte-compile-arglist-warn) + (byte-compile-cl-warn) + (byte-compile-warn-about-unresolved-functions) + (byte-compile-file, byte-compile-fix-header) + (byte-compile--declare-var, byte-compile-file-form-defmumble) + (byte-compile-form, byte-compile-normal-call) + (byte-compile-variable-ref, byte-compile-variable-set) + (byte-compile-subr-wrong-args, byte-compile-setq-default) + (byte-compile-negation-optimizer) + (byte-compile-condition-case--old) + (byte-compile-condition-case--new, byte-compile-save-excursion) + (byte-compile-defvar, byte-compile-autoload) + (byte-compile-lambda-form) + (byte-compile-make-variable-buffer-local, display-call-tree) + (batch-byte-compile): + * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use) + (cconv-analyze-form): + * lisp/emacs-lisp/chart.el (chart-space-usage): + * lisp/emacs-lisp/check-declare.el (check-declare-scan) + (check-declare-warn, check-declare-file) + (check-declare-directory): + * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) + (checkdoc-message-text-engine): + * lisp/emacs-lisp/cl-extra.el (cl-parse-integer): + * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) + (cl-symbol-macrolet): + * lisp/emacs-lisp/cl.el (cl-unload-function, flet): + * lisp/emacs-lisp/copyright.el (copyright) + (copyright-update-directory): + * lisp/emacs-lisp/edebug.el (edebug-read-list): + * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): + * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) + (eieio-oref, eieio-oset-default): + * lisp/emacs-lisp/eieio-speedbar.el: + (eieio-speedbar-child-make-tag-lines) + (eieio-speedbar-child-description): + * lisp/emacs-lisp/eieio.el (defclass, change-class): + * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) + (elint-init-form, elint-check-defalias-form) + (elint-check-let-form): + * lisp/emacs-lisp/ert.el (ert-get-test): + * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) + (find-function-library): + * lisp/emacs-lisp/generator.el (iter-yield): + * lisp/emacs-lisp/gv.el (gv-define-simple-setter): + * lisp/emacs-lisp/lisp-mnt.el (lm-verify): + * lisp/emacs-lisp/package-x.el (package-upload-file): + * lisp/emacs-lisp/package.el (package-version-join) + (package-disabled-p, package-activate-1, package-activate) + (package--download-one-archive) + (package--download-and-read-archives) + (package-compute-transaction, package-install-from-archive) + (package-install, package-install-selected-packages) + (package-delete, package-autoremove) + (package-install-button-action, package-delete-button-action) + (package-menu-hide-package, package-menu--list-to-prompt) + (package-menu--perform-transaction) + (package-menu--find-and-notify-upgrades): + * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): + * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): + * lisp/emacs-lisp/ring.el (ring-next, ring-previous): + * lisp/emacs-lisp/rx.el (rx-check, rx-anything): + * lisp/emacs-lisp/smie.el (smie-config-save): + * lisp/emacs-lisp/subr-x.el (internal--check-binding): + * lisp/emacs-lisp/testcover.el (testcover-1value): + Use curved quotes in diagnostic format strings. + +2015-08-21 Fabián Ezequiel Gallina + + python.el: Ensure remote process-environment on non-interactive processes + * lisp/progmodes/python.el + (python-shell-tramp-refresh-process-environment): New function. + (python-shell-with-environment): Use it. + * test/automated/python-tests.el (python-shell-with-environment-2): Update. + + python.el: Enhancements to process environment setup. + * lisp/progmodes/python.el (python-shell-process-environment) + (python-shell-extra-pythonpaths, python-shell-exec-path) + (python-shell-virtualenv-root): Update docstring. Remove :safe. + (python-shell-setup-codes): Remove :safe. + (python-shell-remote-exec-path): New defcustom. + (python-shell--add-to-path-with-priority): New macro. + (python-shell-calculate-pythonpath): Give priority to + python-shell-extra-pythonpaths. Update docstring. + (python-shell-calculate-process-environment): Give priority to + python-shell-process-environment. Update docstring. + (python-shell-calculate-exec-path): Give priority to + python-shell-exec-path and calculated virtualenv bin directory. + Update docstring. + (python-shell-tramp-refresh-remote-path): New function. + (python-shell-with-environment): Use it when working remotely and + do not modify tramp-remote-path. Allow nesting. + (python-shell-calculate-command): Remove useless + python-shell-with-environment call. + * test/automated/python-tests.el (python-shell-calculate-pythonpath-1) + (python-shell-calculate-pythonpath-2) + (python-shell-calculate-process-environment-6) + (python-shell-calculate-process-environment-7) + (python-shell-calculate-process-environment-8) + (python-shell-calculate-exec-path-3) + (python-shell-calculate-exec-path-4) + (python-shell-calculate-exec-path-5) + (python-shell-calculate-exec-path-6) + (python-shell-with-environment-3): New tests. + (python-shell-calculate-process-environment-2) + (python-shell-calculate-process-environment-3) + (python-shell-calculate-process-environment-4) + (python-shell-calculate-process-environment-5) + (python-shell-calculate-exec-path-1) + (python-shell-calculate-exec-path-2) + (python-shell-with-environment-1) + (python-shell-with-environment-2): Update and simplify. + +2015-08-21 Paul Eggert + + Avoid hard-coding "M-x command" in docstrings + * lisp/calendar/todo-mode.el (todo-mode): + * lisp/desktop.el (desktop-save-mode): + * lisp/edmacro.el (edit-kbd-macro): + * lisp/emacs-lisp/package.el (package-menu-execute): + * lisp/emulation/viper-cmd.el (viper-ask-level): + * lisp/emulation/viper-init.el (viper-expert-level): + * lisp/filesets.el (filesets-add-buffer): + * lisp/follow.el (follow-mode): + * lisp/gnus/auth-source.el (auth-sources): + * lisp/international/ogonek.el (ogonek-informacja) + (ogonek-information): + * lisp/net/tramp.el (tramp-process-actions): + * lisp/org/org-gnus.el (org-gnus-no-new-news): + * lisp/org/org.el (org-ellipsis): + * lisp/progmodes/python.el (python-shell-get-process-or-error): + * lisp/progmodes/vhdl-mode.el (vhdl-mode): + * lisp/server.el (server-start): + * lisp/type-break.el (type-break-noninteractive-query): + * lisp/userlock.el (ask-user-about-supersession-help): + * lisp/whitespace.el (whitespace-report-region): + Prefer (substitute-command-keys "`\\[foo-command]'") + to "`M-x foo-command'" in docstrings and the like. + +2015-08-21 Tassilo Horn + + Use add-function for prettify-symbols-compose-predicate + * lisp/textmodes/tex-mode.el (tex-common-initialization): Set + prettify-symbols-compose-predicate in terms of add-function. + * etc/NEWS: Mention prettify-symbols-compose-predicate and + prettify-symbols-mode support in tex-mode. + +2015-08-21 Stefan Monnier + + * lisp/emacs-lisp/smie.el (smie-indent-current-column): New fun + (smie-indent-exps, smie-indent-keyword): Use it. + * test/indent/css-mode.css: Test alignment with leading comment. + +2015-08-21 Paul Eggert + + Respect text-quoting-style in (*Finder*) menus + * lisp/info.el (info--prettify-description): + Treat description as a docstring, so that it's requoted as + per text-quoting-style. + +2015-08-21 Martin Rudalics + + Document `window-use-time' in Elisp manual + * doc/lispref/windows.texi (Selecting Windows): Document `window-use-time'. + +2015-08-21 Eli Zaretskii + + A better fix for bug#21303 + * src/w32uniscribe.c (_WIN32_WINNT): Define to 0x0600. This is a + cleaner fix for Bug#21260 than the previous change. + +2015-08-21 Paul Eggert + + Respect text-quoting-style in calc + In calc, tespect text-quoting-style preference in diagnostic + formats and fix a few similar problems in docstrings. + * lisp/calc/calc-aent.el (math-read-factor): + * lisp/calc/calc-embed.el (calc-do-embedded): + * lisp/calc/calc-ext.el (calc-user-function-list) + * lisp/calc/calc-graph.el (calc-graph-show-dumb): + * lisp/calc/calc-help.el (calc-describe-key) + (calc-describe-thing): + * lisp/calc/calc-lang.el (calc-c-language) + (math-parse-fortran-vector-end, math-parse-tex-sum) + (math-parse-eqn-matrix, math-parse-eqn-prime) + (calc-yacas-language, calc-maxima-language, calc-giac-language) + (math-read-big-rec, math-read-big-balance): + * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) + (calc-auto-recompute): + * lisp/calc/calc-prog.el (calc-user-define-invocation) + (math-do-arg-check): + * lisp/calc/calc-store.el (calc-edit-variable): + * lisp/calc/calc-units.el (math-build-units-table-buffer): + * lisp/calc/calc-vec.el (math-read-brackets): + * lisp/calc/calc-yank.el (calc-edit-mode): + * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): + Use curved quotes in diagnostic format strings. + * lisp/calc/calc-help.el (calc-describe-thing): + Format docstrings with substitute-command-keys. + * lisp/calc/calc-help.el (calc-j-prefix-help): + * lisp/calc/calc-misc.el (calc-help): + * lisp/calc/calc-ext.el (calc-shift-Z-prefix-help): + Escape a docstring "`". + +2015-08-21 Eli Zaretskii + + Fix documentation of 'menu-set-font' and 'set-frame-font' + * lisp/menu-bar.el (menu-set-font): Doc fix. (Bug#21303) + * doc/lispref/frames.texi (Frame Font): Document that + set-frame-font with the last argument 't' will also make the font + the default for the future GUI frames. + + Document '--create-frame' option to emacsclient + * doc/emacs/misc.texi (emacsclient Options): Document the + '--create-frame' option. (Bug#21308) + +2015-08-21 Stefan Monnier + + * lisp/progmodes/js.el (js-mode): Don't eagerly syntax propertize. + +2015-08-21 Eli Zaretskii + + Document 'get-mru-window' in the ELisp manual + * doc/lispref/windows.texi (Cyclic Window Ordering): Document + 'get-mru-window'. (Bug#21306) + + Clarify documentation of 'get-buffer-window-list' + * doc/lispref/windows.texi (Buffers and Windows): Mention that the + current window, if relevant, will be the first in the list + returned by 'get-buffer-window-list'. + * lisp/window.el (get-buffer-window-list): Doc fix. (Bug#21305) + +2015-08-21 Vasilij Schneidermann + + In `ielm' use `pop-to-buffer-same-window' instead of `switch-to-buffer' + * lisp/ielm.el (ielm): Use `pop-to-buffer-same-window' instead of + `switch-to-buffer'. + +2015-08-21 Kaushal (tiny change) + + In woman.el use `display-buffer' instead of `switch-to-buffer' + * lisp/woman.el (woman-really-find-file, WoMan-find-buffer): Use + `display-buffer' instead of `switch-to-buffer'. + +2015-08-21 Paul Eggert + + Follow user preference in calendar diagnostics + Respect text-quoting-style preference in diagnostic formats by + using curved quotes (which are translated as per text-quoting-style) + instead of grave accent and apostrophe (which are not). + * lisp/calendar/appt.el (appt-display-message): + * lisp/calendar/diary-lib.el (diary-check-diary-file) + (diary-mail-entries, diary-from-outlook): + * lisp/calendar/icalendar.el (icalendar-export-region) + (icalendar--convert-float-to-ical) + (icalendar--convert-date-to-ical) + (icalendar--convert-ical-to-diary) + (icalendar--convert-recurring-to-diary) + (icalendar--add-diary-entry): + * lisp/calendar/time-date.el (format-seconds): + * lisp/calendar/timeclock.el (timeclock-mode-line-display) + (timeclock-make-hours-explicit): + * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) + (todo-item-mark, todo-check-format) + (todo-insert-item--next-param, todo-edit-item--next-key) + (todo-mode): + Use curved quotes in diagnostic format strings. + * lisp/calendar/icalendar.el (icalendar-import-format-sample): + * test/automated/icalendar-tests.el (icalendar--import-format-sample): + Just use straight quoting for simple test case. + +2015-08-21 Michael Albinus + + * src/gfilenotify.c (Fgfile_add_watch): + Handle errors from g_file_monitor. + +2015-08-21 Martin Rudalics + + In frames.texi use "minibuffer-less frame" instead of "non-minibuffer frame" + * doc/lispref/frames.texi (Frame Layout): Use "minibuffer-less + frame" instead of "non-minibuffer frame". + + Fix frame geometry related text + * doc/lispref/frames.texi (Frame Layout): Rename + `x-frame-geometry' to `frame-geometry'. + * doc/lispref/frames.texi (Mouse Position): + * doc/lispref/windows.texi (Coordinates and Windows): Use + `set-mouse-absolute-pixel-position' instead of + `x-set-mouse-absolute-pixel-position'. + + Sanitize frame geometry related functions + * src/nsfns.m (Fx_frame_geometry): Rename to Fns_frame_geometry. + (Fx_frame_edges): Rename to Fns_frame_edges. + * src/w32fns.c (Fx_frame_geometry): Rename to Fw32_frame_geometry. + (Fx_frame_edges): Rename to Fw32_frame_edges. + (Fx_mouse_absolute_pixel_position): Rename to + Fw32_mouse_absolute_pixel_position. + (Fx_set_mouse_absolute_pixel_position): Rename to + Fw32_set_mouse_absolute_pixel_position. + * lisp/frame.el (x-frame-geometry, w32-frame-geometry) + (ns-frame-geometry, x-frame-edges, w32-frame-edges) + (ns-frame-edges, w32-mouse-absolute-pixel-position) + (x-mouse-absolute-pixel-position) + (w32-set-mouse-absolute-pixel-position) + (x-set-mouse-absolute-pixel-position): Declare. + (frame-geometry, mouse-absolute-pixel-position) + (set-mouse-absolute-pixel-position): New functions. + (frame-edges): Rewrite in terms of x-/w32-/ns-frame-edges. + +2015-08-21 Eli Zaretskii + + Fix MinGW64 build broken by latest w32uniscribe.c changes + * src/w32uniscribe.c (UNISCRIBE_OPENTYPE): Define to 0x0100, for + MinGW64. Reported by Andy Moreton . + (Bug#21260) + +2015-08-21 Tassilo Horn + + Add TeX defaults for prettify-symbol-mode + * lisp/textmodes/tex-mode.el (tex--prettify-symbols-alist): Rename + from tex-prettify-symbols-alist. + (tex--prettify-symbols-compose-p): New function. + (tex-common-initialization): Use them as prettify-symbols-alist + and prettify-symbols-compose-predicate. + + Generalize prettify-symbols to arbitrary modes + * lisp/progmodes/prog-mode.el + (prettify-symbols-default-compose-p): New function. + (prettify-symbols-compose-predicate): New variable. + (prettify-symbols--compose-symbol): Use it. + +2015-08-20 Paul Eggert + + Don't quote symbols 'like-this' in docstrings etc. + * admin/unidata/uvs.el (uvs-insert-fields-as-bytes): + * lisp/allout-widgets.el (allout-widgets-count-buttons-in-region): + * lisp/allout.el (allout-add-resumptions, allout-mode): + * lisp/calculator.el (calculator-operators): + * lisp/cedet/data-debug.el (dd-propertize): + * lisp/cedet/ede/proj-prog.el (ede-proj-target-makefile-program): + * lisp/cedet/semantic/analyze/debug.el: + (semantic-analyzer-debug-global-miss-text): + * lisp/cedet/semantic/lex-spp.el: + (semantic-lex-spp-replace-or-symbol-or-keyword): + * lisp/cedet/semantic/symref.el: + (semantic-symref-cleanup-recent-buffers-fcn): + * lisp/cedet/semantic/tag.el (semantic-tag-class): + * lisp/cedet/srecode/el.el (srecode-semantic-handle-:el-custom): + * lisp/gnus/nnmairix.el (nnmairix-propagate-marks-upon-close): + * lisp/gnus/pop3.el (pop3-authentication-scheme): + * lisp/help-fns.el (describe-function-orig-buffer): + * lisp/imenu.el (imenu--history-list): + * lisp/mail/feedmail.el (feedmail-confirm-outgoing) + (feedmail-display-full-frame, feedmail-deduce-bcc-where) + (feedmail-queue-default-file-slug) + (feedmail-queue-buffer-file-name): + * lisp/net/mairix.el (mairix-searches-mode-map): + * lisp/net/newst-backend.el (newsticker-retrieval-method) + (newsticker-auto-mark-filter-list): + * lisp/obsolete/vi.el (vi-mode): + * lisp/progmodes/cc-engine.el (c-literal-type): + * lisp/progmodes/cpp.el (cpp-face): + * lisp/progmodes/ebrowse.el (ebrowse-electric-list-looper): + * lisp/progmodes/elisp-mode.el (elisp--xref-make-xref): + * lisp/progmodes/pascal.el (pascal-auto-lineup): + * lisp/progmodes/prog-mode.el (prog-widen): + * lisp/progmodes/verilog-mode.el (verilog-regexp-words) + (verilog-auto-lineup, verilog-auto-reset-widths) + (verilog-auto-arg-format, verilog-auto-inst-template-numbers): + * lisp/textmodes/flyspell.el (flyspell-maybe-correct-transposition) + (flyspell-maybe-correct-doubling): + * lisp/textmodes/table.el (table-justify, table-justify-cell) + (table-justify-row, table-justify-column, table-insert-sequence) + (table--justify-cell-contents): + * lisp/url/url-auth.el (url-get-authentication): + * lisp/window.el (display-buffer-record-window): + * lisp/xml.el (xml-parse-file, xml-parse-region): + * src/gfilenotify.c (Fgfile_add_watch): + Don't quote symbols with apostrophes in doc strings. + Use asymmetric quotes instead. + * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): + Likewise for symbol in diagnostic. + * lisp/image.el (image-extension-data): + * lisp/register.el (frame-configuration-to-register): + * src/buffer.c (syms_of_buffer): + Remove bogus apostrophes after symbols. + * lisp/thumbs.el (thumbs-conversion-program): + Quote Lisp string values using double-quotes, not apostrophes. + +2015-08-20 Martin Rudalics + + Describe frame geometry and related functions in Elisp manual + * doc/lispref/display.texi (Size of Displayed Text, Line Height) + (Showing Images): Update references. + * doc/lispref/elisp.texi (Top): Update node listing. + * doc/lispref/frames.texi (Frame Geometry): New node. Move + `Size and Position' section here. + (Size Parameters): Update references. + (Mouse Position): Update references and nomenclature. Describe + new functions `x-mouse-absolute-pixel-position' and + `x-set-mouse-absolute-pixel-position'. + * doc/lispref/windows.texi (Window Sizes): Update references. + (Resizing Windows): Update references. Move description of + `fit-frame-to-buffer' here. + (Coordinates and Windows): Update nomenclature and references. + Describe new arguments of `window-edges'. Comment out + descriptions of `window-left-column', `window-top-line', + `window-pixel-left' and `window-pixel-top'. Describe + `window-absolute-pixel-position'. + +2015-08-20 Alan Mackenzie + + Handling of `c-parse-state'. Fix low level bug. + progmodes/cc-engine.el (c-remove-stale-state-cache-backwards): Add + "CASE 3.5" to handle `cache-pos' being only slightly before `here'. + +2015-08-20 Andreas Politz + + In `widget-color--choose-action' quit *Color* window instead of deleting it + * lisp/wid-edit.el (widget-color--choose-action): Quit *Color* + window instead of deleting it. + +2015-08-20 Martin Rudalics + + In w32fns.c's Fx_frame_geometry rewrite check whether frame has a titlebar + * src/w32fns.c (Fx_frame_geometry): Use title_bar.rgstate[0] to + determine whether frame has a titlebar. + Suggested by Eli Zaretskii + +2015-08-20 Tassilo Horn + + Add a prettify-symbols-alist for (La)TeX + * tex-mode.el (tex-prettify-symbols-alist): New variable holding + an alist suitable as prettify-symbols-alist in (La)TeX modes. + +2015-08-19 Alan Mackenzie + + Make electric-pair-mode, delete-selection-mode and CC Mode cooperate. + Fixes debbugs#21275. + In Emacs >= 25, let electric-pair-mode take precedence over + delete-selection-mode. + delsel.el (delete-selection-uses-region-p): New function, previously a + lambda expression in a property value for `self-insert-command'. + (top-level) Set the `delete-selection' property of `self-insert-command' + to `delete-selection-uses-region-p'. + progmodes/cc-cmds.el (top-level): Give the `delete-selection' property + for c-electric-\(brace\|paren\) the value `delete-selection-uses-region-p' + when the latter function exists. + +2015-08-19 Paul Eggert + + Fix key binding quoting in tutorial *Help* + * lisp/tutorial.el (tutorial--describe-nonstandard-key): + When generating help for custom key bindings, use the user-preferred + quoting style rather than hardcoding the grave style. + +2015-08-19 Eli Zaretskii + + Improve and future-proof OTF fonts support in w32uniscribe.c + * src/w32uniscribe.c (uniscribe_otf_capability): Add commentary + about the expected results and why the new Uniscribe APIs are not + used in this function. + (ScriptGetFontScriptTags_Proc, ScriptGetFontLanguageTags_Proc) + (ScriptGetFontFeatureTags_Proc): New function typedefs. + (uniscribe_new_apis): New static variable. + (uniscribe_check_features): New function, implements OTF features + verification while correctly accounting for features in the list + after the nil member, if any. + (uniscribe_check_otf_1): New function, retrieves the features + supported by the font for the requested script and language using + the Uniscribe APIs available from Windows Vista onwards. + (uniscribe_check_otf): If the new Uniscribe APIs are available, + use them in preference to reading the font data directly. Call + uniscribe_check_features to verify that the requested features are + supported, replacing the original incomplete code. + (syms_of_w32uniscribe): Initialize function pointers for the new + Uniscribe APIs. (Bug#21260) + (otf_features): Scan the script, langsys, and feature arrays back + to front, so that the result we return has them in alphabetical + order, like ftfont.c does. + * src/w32fns.c (syms_of_w32fns) : + New variable for debugging w32uniscribe.c code. + +2015-08-19 Artur Malabarba + + * isearch.el (isearch-search-fun-default): Revert a5bdb87 + Remove usage of `isearch-lax-whitespace' inside the `iearch-word' + clause of `isearch-search-fun-default'. That lax variable does not + refer to lax-whitespacing. Related to (bug#21777). + This reverts commit a5bdb872edb9f031fe041faf9a8c0be432e5f64c. + * character-fold.el (character-fold-search): Set to nil + Default to nil for now, until someone implements proper + lax-whitespacing with char-fold searching. + +2015-08-19 Martin Rudalics + + Fix doc-string of `help-mode-finish'. + * lisp/help-mode.el (help-mode-finish): Fix doc-string. + + In nsimage.m include coding.h (Bug#21292) + * src/nsimage.m (top-level): Include coding.h (Bug#21292). + + Move window edge functions to Elisp. + * src/window.c (Fwindow_edges, Fwindow_pixel_edges) + (Fwindow_absolute_pixel_edges, Fwindow_inside_edges) + (Fwindow_inside_pixel_edges, Fwindow_inside_absolute_pixel_edges): + Move to window.el. + (calc_absolute_offset): Remove. + * lisp/frame.el (frame-edges): New function. + * lisp/window.el (window-edges, window-pixel-edges) + (window-absolute-pixel-edges): Move here from window.c. + (window-body-edges, window-body-pixel-edges) + (window-absolute-body-pixel-edges): Move here from window.c and + rename "inside" to "body". Keep old names as aliases. + (window-absolute-pixel-position): New function. + +2015-08-19 Katsumi Yamaoka + + [Gnus]: Use overlay functions directly + * lisp/gnus/gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part) + (gnus-insert-mime-button, gnus-mime-buttonize-attachments-in-header) + (gnus-article-highlight-signature, gnus-article-extend-url-button) + (gnus-article-add-button, gnus-insert-prev-page-button) + (gnus-insert-next-page-button, gnus-insert-mime-security-button): + * lisp/gnus/gnus-cite.el (gnus-cite-delete-overlays) + (gnus-cite-add-face): + * lisp/gnus/gnus-html.el (gnus-html-wash-tags): + * lisp/gnus/gnus-salt.el (gnus-tree-read-summary-keys) + (gnus-tree-recenter, gnus-highlight-selected-tree): + * lisp/gnus/gnus-sum.el (gnus-summary-show-all-threads) + (gnus-summary-show-thread, gnus-summary-hide-thread) + (gnus-highlight-selected-summary): + * lisp/gnus/gnus-util.el (gnus-put-overlay-excluding-newlines): + * lisp/gnus/message.el (message-fix-before-sending) + (message-toggle-image-thumbnails): + * lisp/gnus/mm-decode.el (mm-convert-shr-links): + * lisp/gnus/sieve.el (sieve-highlight, sieve-insert-scripts): + Use overlay functions directly instead of using gnus-overlay-*, + message-overlay-*, and sieve-overlay-*. + * lisp/gnus/gnus-sum.el (gnus-remove-overlays): + * lisp/gnus/gnus.el (gnus-make-overlay, gnus-copy-overlay) + (gnus-delete-overlay, gnus-overlay-get, gnus-overlay-put) + (gnus-move-overlay, gnus-overlay-buffer, gnus-overlay-start) + (gnus-overlay-end, gnus-overlays-at, gnus-overlays-in): + * lisp/gnus/message.el (message-delete-overlay, message-make-overlay) + (message-overlay-get, message-overlay-put, message-overlays-in): + * lisp/gnus/sieve.el (sieve-make-overlay, sieve-overlay-put) + (sieve-overlays-at): + Remove. + +2015-08-19 Martin Rudalics + + In w32fns.c condition TITLEBAR_INFO declaration on WINDOWS version. + * src/w32fns.c (TITLEBAR_INFO): Make it a typedef so MinGW64 + builds can use the declaration from the system headers. + (GetTitleBarInfo_Proc, Fx_frame_geometry): Adapt to new + definition of TITLEBAR_INFO. + Suggested by Eli Zaretskii + +2015-08-19 Glenn Morris + + * lisp/gnus/nnmaildir.el (nnmaildir-flag-mark-mapping): Add "P". + +2015-08-19 Paul Eggert + + Use new q ‘format’ flag when fixing quotes in C + * src/image.c (image_size_error): New function. All uses of + image_error with "Invalid image size ..." changed to use it. + * src/image.c (image_size_error, xbm_load_image, xbm_load) + (xpm_load, xpm_load_image, xpm_load, pbm_load, png_load_body) + (jpeg_load_body, tiff_load, gif_load, imagemagick_load_image) + (imagemagick_load, svg_load, svg_load_image, gs_load) + (x_kill_gs_process): + * src/lread.c (load_warn_old_style_backquotes): + * src/xfaces.c (load_pixmap): + * src/xselect.c (x_clipboard_manager_error_1): + Use %qs, not uLSQM and uRSQM. + * src/syntax.c (Finternal_describe_syntax_value): + Prefer Fsubstitute_command_keys to Fformat, as this lets + us use AUTO_STRING. + * src/xdisp.c (vadd_to_log): Use AUTO_STRING on the format argument, + as it's now guaranteed to be ASCII. + * src/xselect.c (x_clipboard_manager_error_2): + Avoid grave accent in low-level stderr diagnostic. + +2015-08-19 Paul Eggert + + New q flag for ‘format’ + * doc/lispref/processes.texi (Sentinels): + Don't hardwire grave quoting style in example. + * doc/lispref/strings.texi (Formatting Strings): + * etc/NEWS: + Document new q flag. + * src/editfns.c (Fformat): Implement it. + +2015-08-18 Daiki Ueno + + pinentry.el: Add debugging support + * lisp/net/pinentry.el (pinentry-debug): New variable. + (pinentry-debug-buffer): New variable. + (pinentry--process-filter): Send input to the debug buffer, if + `pinentry-debug' is set. + + pinentry.el: Improve multiline prompt + * lisp/net/pinentry.el (pinentry--prompt): Simplify the interface. + (pinentry--process-filter): Use `pinentry--prompt' for CONFIRM + command. + +2015-08-18 Paul Eggert + + Fix multibyte confusion in diagnostics + * src/print.c (print_error_message): + Don't assume that the caller's name is unibyte. + * src/xdisp.c (vadd_to_log): + Don't assume that the formatted diagnostic is unibyte. + + Fix file name encodings in diagnostics + Also, close some minor races when opening image files, by opening + them once instead of multiple times. + * src/gtkutil.c (xg_get_image_for_pixmap): + * src/image.c (xpm_load, tiff_load, gif_load, imagemagick_load) + (svg_load): + * src/nsimage.m (allocInitFromFile:): + * src/xfns.c (xg_set_icon): + Encode file name, since x_find_image_file no longer does that. + * src/image.c (x_find_image_fd): New function. + (x_find_image_file): Use it. Do not encode resulting file name, + since callers sometimes need it decoded. + (slurp_file): File arg is now a fd, not a file name. + All callers changed. This saves us having to open the file twice. + (xbm_load, xpm_load, pbm_load, png_load_body, jpeg_load_body) + (svg_load): + Use x_find_image_fd and fdopen to save a file-open. + Report file name that failed. + * src/lread.c (openp): If PREDICATE is t, open the file in binary mode. + +2015-08-18 Dmitry Gutov + + Allow blink-matching-paren to jump off screen + * doc/emacs/programs.texi (Matching): Mention the + `blink-matching-paren' value `jump-offscreen'. + * lisp/simple.el (blink-matching-paren): New possible value. + (blink-matching-paren-on-screen): Clarify the docstring. + (blink-matching-open): Handle `jump-offscreen' (bug#21286). + + Refine the previous change + * lisp/simple.el (blink-matching-open): Use minibuffer-message + outside of save-excursion (bug#21286). + +2015-08-18 Martin Rudalics + + Rewrite and add frame geometry related functions. + * src/frame.c (Fframe_position): New function. + (Fset_frame_position): Rename parameters and rewrite doc-string. + (syms_of_frame): Remove Qframe_position, Qframe_outer_size, + Qtitle_height and Qframe_inner_size. Add Qouter_edges, + Qouter_position, Qouter_size, Qnative_edges, Qinner_edges, + Qtitle_bar_size. + * src/nsfns.m (frame_geometry): New function. + (Fx_frame_geometry): Call frame_geometry. + (Fx_frame_edges): New function. + * src/w32fns.c (C_CHILDREN_TITLEBAR, TITLEBAR_INFO) + (GetTitleBarInfo_Proc): Define these so we can use the + GetTitleBarInfo API. + (Fw32_frame_menu_bar_size, Fw32_frame_rect): Remove. + (Fx_frame_geometry): Rewrite. + (Fx_frame_edges, Fx_mouse_absolute_pixel_position) + (Fx_set_mouse_absolute_pixel_position): New functions. + * src/xfns.c (frame_geometry): New function. + (Fx_frame_geometry): Call frame_geometry. + (Fx_frame_edges, Fx_mouse_absolute_pixel_position) + (Fx_set_mouse_absolute_pixel_position): New functions. + +2015-08-18 Michael Albinus + + Improve Tramp's compatibility + * lisp/net/tramp.el (tramp-get-method-parameter): + * lisp/net/tramp-adb.el (tramp-adb-parse-device-names) + (tramp-adb-get-device): + * lisp/net/trampver.el (tramp-repository-get-version): + Use `tramp-compat-replace-regexp-in-string'. + +2015-08-18 Pierre Téchoueyres (tiny change) + + * lisp/net/tramp-cmds.el (tramp-reporter-dump-variable): + Encode/decode string. + +2015-08-18 Paul Eggert + + Clarify what happens to match data on failure + Problem reported by Ernesto Alfonso (Bug#21279). + * doc/lispref/searching.texi (Regexp Search, Simple Match Data): + Document more carefully what happens to match data after a failed + search. + * src/search.c (Fmatch_beginning, Fmatch_end): Document that + the return value is undefined if the last search failed. + (Fmatch_data): Simplify doc string line 1. + +2015-08-18 Daiki Ueno + + Revert "pinentry.el: Support external passphrase cache" + This reverts commit e086e55a664ec27fbca7b3231c4b32cb78a89337. + pinentry.el shouldn't directly interact with the secrets service, + but ask the caller to cache the passphrase. + +2015-08-17 Xue Fuqiao + + * doc/emacs/sending.texi (Mail Misc): Fix two index entries for + Message mode hooks. + +2015-08-17 Daiki Ueno + + epg.el: Make gpgconf output parsing future proof + * lisp/epg.el (epg--start): Count the number of fields in "gpgconf + --list-options" output. + + pinentry.el: Support external passphrase cache + * lisp/net/pinentry.el (pinentry-use-secrets): New user option. + (pinentry--allow-external-password-cache): New local variable. + (pinentry--key-info): New local variable. + (secrets-enabled, secrets-search-items, secrets-get-secret): + Declare. + (pinentry--send-passphrase): New function, split from + `pinentry--process-filter'. + (pinentry--process-filter): Use secrets.el to retrieve passphrase + from login keyring. + + pinentry.el: Popup window for multiline prompt + * lisp/net/pinentry.el (pinentry): New custom group. + (pinentry-popup-prompt-window): New user option. + (pinentry-prompt-window-height): New user option. + (pinentry--prompt-buffer): New variable. + (pinentry-prompt-mode-map): New variable. + (pinentry-prompt-mode): New function. + (pinentry--prompt): New function. + (pinentry--process-filter): Use `pinentry--prompt' instead of + `read-passwd' and `y-or-n-p'. + +2015-08-17 Katsumi Yamaoka + + message.el: Silent the byte compiler + * lisp/gnus/message.el (message-overlay-put, message-make-overlay) + (message-kill-all-overlays, message-overlays-in, message-overlay-get) + (message-delete-overlay, message-window-inside-pixel-edges): + Declare before using. + + * lisp/gnus/message.el (message-overlay-get, message-overlays-in) + (message-window-inside-pixel-edges): XEmacs compatible functions. + +2015-08-17 Lars Magne Ingebrigtsen + + * message.el (message-toggle-image-thumbnails): New command. + +2015-08-17 Noah Friedman + + (blink-matching-open): Restore point before calling minibuffer-message. + +2015-08-17 Ronnie Schnell + + Update version number in header (now matches help) + +2015-08-17 Paul Eggert + + Curved quotes in --batch diagnostics in non-UTF-8 + When run with --batch, check that curved quotes are compatible with + the system locale before outputting them in diagnostics. + Problem reported by Eli Zaretskii in: + http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00594.html + * lisp/startup.el (command-line): Set internal--text-quoting-flag + after the standard display table is initialized. + * src/doc.c (default_to_grave_quoting_style): New function. + (text_quoting_style): Use it. + (text_quoting_flag): New static var, visible to Lisp as + internal--text-quoting-flag. + * src/emacs.c: Include if available. + (using_utf8): New function. + (main): Use it to initialize text_quoting_flag. + * src/regex.h (btowc) [WIDE_CHAR_SUPPORT && emacs]: + Don't define, as it's not needed and it clashes with wchar.h. + +2015-08-17 Glenn Morris + + * doc/misc/tramp.texi (Configuration): Reword to avoid warning + from makeinfo about spurious "Note:" cross-reference, and for grammar. + +2015-08-17 Ilya Zakharevich + + Minor change in variable initialization on MS-Windows + * src/w32fns.c : Initialize to -1. + (deliver_wm_chars): If after_deadkey is zero, don't set after_dead + non-zero. + + Fix a bug with LWindow key remapping on MS-Windows + * src/w32fns.c (deliver_wm_chars): Fix a typo. (Bug#21276) + +2015-08-17 Eli Zaretskii + + Improve fontset support for latest OTF script tags + * lisp/international/fontset.el (otf-script-alist): Add some + missing script tags. + (setup-default-fontset): Include settings for v2 versions of the + script tags used by some modern OTF/TTF fonts. + +2015-08-17 Paul Eggert + + Spelling fixes + +2015-08-16 Paul Eggert + + Use curved quotes in core elisp diagnostics + In the core elisp files, use curved quotes in diagnostic formats, + so that they follow user preference as per ‘text-quoting-style’ + rather than being hard-coded to quote `like this'. + * lisp/abbrev.el (expand-region-abbrevs): + * lisp/button.el (button-category-symbol, button-put) + (make-text-button): + * lisp/cus-start.el: + * lisp/custom.el (custom-add-dependencies, custom-check-theme) + (custom--sort-vars-1, load-theme): + * lisp/emacs-lisp/byte-run.el (defun, defsubst): + * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) + (cl-generic-generalizers): + * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): + * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): + * lisp/emacs-lisp/nadvice.el (advice--make-docstring) + (advice--make, define-advice): + * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): + * lisp/emacs-lisp/timer.el (timer-event-handler): + * lisp/env.el (setenv): + * lisp/facemenu.el (facemenu-add-new-face) + (facemenu-add-new-color): + * lisp/faces.el (face-documentation, read-face-name) + (face-read-string, read-face-font, face-spec-set-match-display) + (read-color, x-resolve-font-name): + * lisp/files.el (locate-user-emacs-file, find-alternate-file) + (set-auto-mode, hack-local-variables) + (hack-one-local-variable--obsolete) + (dir-locals-set-directory-class, write-file) + (basic-save-buffer, delete-directory, copy-directory) + (recover-session, recover-session-finish, insert-directory) + (file-modes-char-to-who, file-modes-symbolic-to-number) + (move-file-to-trash): + * lisp/font-lock.el (font-lock-fontify-buffer): + * lisp/format.el (format-write-file, format-find-file) + (format-insert-file): + * lisp/frame.el (get-device-terminal, select-frame-by-name): + * lisp/fringe.el (fringe--check-style): + * lisp/help.el (describe-minor-mode-from-indicator): + * lisp/image.el (image-type): + * lisp/international/fontset.el (x-must-resolve-font-name): + * lisp/international/mule-cmds.el (prefer-coding-system) + (select-safe-coding-system-interactively) + (select-safe-coding-system, activate-input-method) + (toggle-input-method, describe-current-input-method): + * lisp/international/mule-conf.el (code-offset): + * lisp/mouse.el (minor-mode-menu-from-indicator): + * lisp/replace.el (query-replace-read-from) + (occur-after-change-function, occur-1): + * lisp/scroll-bar.el (scroll-bar-columns): + * lisp/simple.el (execute-extended-command) + (undo-outer-limit-truncate, compose-mail, set-variable) + (choose-completion-string, define-alternatives): + * lisp/startup.el (site-run-file, tty-handle-args, ) + (command-line, command-line-1): + * lisp/subr.el (noreturn, define-error, add-to-list) + (read-char-choice): + * lisp/term/common-win.el (x-handle-xrm-switch) + (x-handle-name-switch, x-handle-args): + * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): + Use curved quotes in diagnostics. + * lisp/international/mule.el (find-auto-coding): + Use " to quote in a diagnostic, to be consistent with the rest of + this file. + + Convert lisp/term/x-win.el to UTF-8 + * lisp/term/x-win.el: Convert to UTF-8. This doesn't affect + runtime behavior, and the file is multilingual so compile-time + appearance shouldn't be an issue. + * admin/notes/unicode: Document this. + +2015-08-16 Wilson Snyder + + Update verilog-mode.el to 2015-05-14-6232468-vpo-GNU. + * losp/progmodes/verilog-mode.el: Fix some non-automated indent + issues and comments, bug943. (verilog-type-font-keywords): Cycle + delay operators like ##1 and ##[0:$] are now highlighted in their + entirety similarly to the # delay-control operator. Likewise, the + followed-by operators #-# and #=# are no longer partially + highlighed. (verilog-backward-syntactic-ws-quick, + verilog-skip-backward-comments): Minor performance improvements to + buffer traversal functions for reduced latency. (verilog-calc-1, + verilog-in-deferred-immediate-final-p): When the keyword 'final' + follows 'assert/assume/cover', then it is part of a deferred + immediate assertion item and should not be treated as a final + construct for indentation. Reported by Yuri Sugihara. + (verilog-do-indent): Virtual task/function/class definition lines + should not be considered as declarations. Reported by Enzo Chi. + (verilog-do-indent): Do not falsely indent to '=' of + property/sequence operators on subsequent lines of a multi-line + statement. (verilog-assignment-operator-re): Fix '!==' operator + and add support for '<->', ':/', '#-#', and '#=#' operators. + (verilog-calculate-indent, verilog-label-be): Enable + case-sensitive regular expression parsing when looking for + keywords. (verilog-calc-1): Detect 'pure virtual method' + declarations which exist in abstract classes. Reported by Enzo + Chi and Kaushal Modi. (verilog-backward-ws&directives): When + moving back to the start of a line and the preceeding line ended + with an escaped-newline, then jump up one line. This properly + consumes a multi-line pre-processor directive. Reported by + Kaushal Modi. (verilog-dpi-import-export-re, + verilog-extended-complete-re, verilog-calc-1): Teach verilog-mode + to properly indent after a DPI import/export statement that + resides outside of a module. Reported by Kaushal Modi. + (verilog-extended-complete-re): Update regexp to match both + "DPI-C" and "DPI". Reported by Kaushal Modi. + 2015-08-15 Paul Eggert substitute-command-keys a few more doc strings @@ -9441,7 +10469,7 @@ This file records repository revisions from commit 9d56a21e6a696ad19ac65c4b405aeca44785884a (exclusive) to -commit f7ee23e587b01f179284b5554c67d579a2def676 (inclusive). +commit a664f6a5d586e1f3fdbf31d0cf2fdaa6429a58fe (inclusive). See ChangeLog.1 for earlier changes. ;; Local Variables: commit a664f6a5d586e1f3fdbf31d0cf2fdaa6429a58fe Author: Xue Fuqiao Date: Sun Aug 23 16:57:56 2015 +0800 * doc/emacs/modes.texi (Choosing Modes): Minor doc fix for magic-fallback-mode-alist. diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi index e79561a..d442f85 100644 --- a/doc/emacs/modes.texi +++ b/doc/emacs/modes.texi @@ -435,7 +435,8 @@ compares the text at the start of the buffer to the variable @code{magic-mode-alist}, described above, except that is consulted only after @code{auto-mode-alist}. By default, @code{magic-fallback-mode-alist} contains forms that check for image -files, HTML/XML/SGML files, and PostScript files. +files, HTML/XML/SGML files, PostScript files, and Unix style Conf +files. @findex normal-mode If you have changed the major mode of a buffer, you can return to