aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-02-09 00:03:39 +0100
committerJoakim Verona2013-02-09 00:03:39 +0100
commit4df065db6acba3975884b435422773ab97f32a00 (patch)
tree37a7fd1db38463d6de1acd0269588bf5a5ba9ded
parente38ad9acca0c806654313993728f9fabd1090f4f (diff)
parent75a65c7eb471bb7c6a5b7dc14a762ff997a5d354 (diff)
downloademacs-4df065db6acba3975884b435422773ab97f32a00.tar.gz
emacs-4df065db6acba3975884b435422773ab97f32a00.zip
auto upstream
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/keymaps.texi7
-rw-r--r--doc/misc/ChangeLog4
-rw-r--r--doc/misc/eshell.texi535
-rw-r--r--etc/TODO7
-rw-r--r--leim/ChangeLog4
-rw-r--r--leim/quail/latin-ltx.el18
-rw-r--r--lisp/ChangeLog23
-rw-r--r--lisp/emacs-lisp/byte-run.el10
-rw-r--r--lisp/eshell/em-ls.el22
-rw-r--r--lisp/eshell/esh-proc.el67
-rw-r--r--lisp/icomplete.el7
-rw-r--r--lisp/simple.el6
-rw-r--r--src/ChangeLog35
-rw-r--r--src/alloc.c15
-rw-r--r--src/ccl.c3
-rw-r--r--src/charset.c4
-rw-r--r--src/coding.c8
-rw-r--r--src/composite.c2
-rw-r--r--src/doc.c14
-rw-r--r--src/font.c8
-rw-r--r--src/fontset.c5
-rw-r--r--src/ftfont.c3
-rw-r--r--src/indent.c2
-rw-r--r--src/lisp.h21
-rw-r--r--src/lread.c67
-rw-r--r--src/nsselect.m2
-rw-r--r--src/search.c22
-rw-r--r--src/syntax.c11
-rw-r--r--src/w32uniscribe.c4
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c14
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xselect.c12
34 files changed, 672 insertions, 301 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 111a1594512..7c444a038af 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12013-02-08 Glenn Morris <rgm@gnu.org>
2
3 * keymaps.texi (Active Keymaps, Searching Keymaps):
4 Remove confusing mention of "symbolic prefix". (Bug#13643)
5
12013-01-19 Glenn Morris <rgm@gnu.org> 62013-01-19 Glenn Morris <rgm@gnu.org>
2 7
3 * macros.texi (Indenting Macros): Fix order of an indent 8 * macros.texi (Indenting Macros): Fix order of an indent
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index cb6c785905c..7c66bbec801 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -634,8 +634,8 @@ keymap, and the global keymap, in that order. Emacs searches for each
634input key sequence in all these keymaps. @xref{Searching Keymaps}, 634input key sequence in all these keymaps. @xref{Searching Keymaps},
635for more details of this procedure. 635for more details of this procedure.
636 636
637 When the key sequence starts with a mouse event (optionally preceded 637 When the key sequence starts with a mouse event,
638by a symbolic prefix), the active keymaps are determined based on the 638the active keymaps are determined based on the
639position in that event. If the event happened on a string embedded 639position in that event. If the event happened on a string embedded
640with a @code{display}, @code{before-string}, or @code{after-string} 640with a @code{display}, @code{before-string}, or @code{after-string}
641property (@pxref{Special Properties}), the non-@code{nil} map 641property (@pxref{Special Properties}), the non-@code{nil} map
@@ -766,8 +766,7 @@ them:
766@var{find-in} and @var{find-in-any} are pseudo functions that search 766@var{find-in} and @var{find-in-any} are pseudo functions that search
767in one keymap and in an alist of keymaps, respectively. (Searching a 767in one keymap and in an alist of keymaps, respectively. (Searching a
768single keymap for a binding is called @dfn{key lookup}; see @ref{Key 768single keymap for a binding is called @dfn{key lookup}; see @ref{Key
769Lookup}.) If the key sequence starts with a mouse event, or a 769Lookup}.) If the key sequence starts with a mouse event, that event's position
770symbolic prefix event followed by a mouse event, that event's position
771is used instead of point and the current buffer. Mouse events on an 770is used instead of point and the current buffer. Mouse events on an
772embedded string use non-@code{nil} text properties from that string 771embedded string use non-@code{nil} text properties from that string
773instead of the buffer. @var{temp-map} is a pseudo variable that 772instead of the buffer. @var{temp-map} is a pseudo variable that
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 7ebaa5534d1..c0a454d31b5 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,7 @@
12013-02-08 Aidan Gauland <aidalgol@no8wireless.co.nz>
2
3 * eshell.texi: Fill most of the missing sections.
4
12013-02-07 Bastien Guerry <bzg@gnu.org> 52013-02-07 Bastien Guerry <bzg@gnu.org>
2 6
3 * org.texi (References): Clarify an example. 7 * org.texi (References): Clarify an example.
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index 504940c5c6b..9825c90dd81 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -2,6 +2,7 @@
2@c %**start of header 2@c %**start of header
3@setfilename ../../info/eshell 3@setfilename ../../info/eshell
4@settitle Eshell: The Emacs Shell 4@settitle Eshell: The Emacs Shell
5@defindex cm
5@synindex vr fn 6@synindex vr fn
6@c %**end of header 7@c %**end of header
7 8
@@ -42,7 +43,7 @@ modify this GNU manual.''
42@c -release- 43@c -release-
43@end ignore 44@end ignore
44@sp 3 45@sp 3
45@center John Wiegley 46@center John Wiegley & Aidan Gauland
46@c -date- 47@c -date-
47 48
48@page 49@page
@@ -75,16 +76,15 @@ handling the sort of tasks accomplished by those tools.
75* What is Eshell?:: A brief introduction to the Emacs Shell. 76* What is Eshell?:: A brief introduction to the Emacs Shell.
76* Command basics:: The basics of command usage. 77* Command basics:: The basics of command usage.
77* Commands:: 78* Commands::
78* Arguments:: 79* Expansion::
79* Input/Output:: 80* Input/Output::
80* Process control::
81* Extension modules:: 81* Extension modules::
82* Extras and Goodies::
83* Bugs and ideas:: Known problems, and future ideas. 82* Bugs and ideas:: Known problems, and future ideas.
84* GNU Free Documentation License:: The license for this documentation. 83* GNU Free Documentation License:: The license for this documentation.
85* Concept Index:: 84* Concept Index::
86* Function and Variable Index:: 85* Function and Variable Index::
87* Key Index:: 86* Key Index::
87* Command Index::
88@end menu 88@end menu
89 89
90@node What is Eshell? 90@node What is Eshell?
@@ -278,83 +278,56 @@ on your mind. Have fun!
278@node Commands 278@node Commands
279@chapter Commands 279@chapter Commands
280 280
281In a command shell, everything is done by invoking commands. This
282chapter covers command invocations in Eshell, including the command
283history and invoking commands in a script file.
284
281@menu 285@menu
282* Invocation:: 286* Invocation::
283* Completion:: 287* Arguments::
288* Variables::
289* Built-ins::
284* Aliases:: 290* Aliases::
285* History:: 291* History::
292* Completion::
293* for loop::
286* Scripts:: 294* Scripts::
287* Built-ins::
288@end menu 295@end menu
289 296
290Essentially, a command shell is all about invoking commands---and
291everything that entails. So understanding how Eshell invokes commands
292is the key to comprehending how it all works.
293
294@node Invocation 297@node Invocation
295@section Invocation 298@section Invocation
296
297Unlike regular system shells, Eshell never invokes kernel functions 299Unlike regular system shells, Eshell never invokes kernel functions
298directly, such as @code{exec(3)}. Instead, it uses the Lisp functions 300directly, such as @code{exec(3)}. Instead, it uses the Lisp functions
299available in the Emacs Lisp library. It does this by transforming the 301available in the Emacs Lisp library. It does this by transforming the
300command you specify into a callable Lisp form.@footnote{To see the Lisp 302input line into a callable Lisp form.@footnote{To see the Lisp form that will be invoked, type: @samp{eshell-parse-command "echo hello"}}
301form that will be invoked, type: @samp{eshell-parse-command "echo 303
302hello"}} 304The command can be either an Elisp function or an external command.
303 305Eshell looks first for an @ref{Aliases, alias} with the same name as the
304This transformation, from the string of text typed at the command 306command, then a @ref{Built-ins, built-in command} or a function with the
305prompt, to the ultimate invocation of either a Lisp function or external 307same name; if there is no match, it then tries to execute it as an
306command, follows these steps: 308external command.
307 309
308@enumerate 310The semicolon (@code{;}) can be used to separate multiple command
309@item Parse the command string into separate arguments. 311invocations on a single line. A command invocation followed by an
310@item 312ampersand (@code{&}) will be run in the background. Eshell has no job
311@end enumerate 313control, so you can not suspend or background the current process, or
312 314bring a background process into the foreground. That said, background
313@node Completion 315processes invoked from Eshell can be controlled the same way as any
314@section Completion 316other background process in Emacs.
315
316@node Aliases
317@section Aliases
318
319@node History
320@section History
321
322Eshell knows a few built-in variables:
323
324@table @code
325
326@item $+
327@vindex $+
328This variable always contains the current working directory.
329
330@item $-
331@vindex $-
332This variable always contains the previous working directory (the
333current working directory from before the last @code{cd} command).
334
335@item $_
336@vindex $_
337It refers to the last argument of the last command.
338
339@item $$
340@vindex $$
341This is the result of the last command. In case of an external
342command, it is @code{t} or @code{nil}.
343
344@item $?
345@vindex $?
346This variable contains the exit code of the last command (0 or 1 for
347Lisp functions, based on successful completion).
348
349@end table
350
351@node Scripts
352@section Scripts
353 317
318@node Arguments
319@section Arguments
320Command arguments are passed to the functions as either strings or
321numbers, depending on what the parser thinks they look like. If you
322need to use a function that takes some other data type, you will need to
323call it in an Elisp expression (which can also be used with
324@ref{Expansion, expansions}). As with other shells, you can
325escape special characters and spaces with the backslash (@code{\}) and
326the single (@code{''}) and double (@code{""}) quotes.
354 327
355@node Built-ins 328@node Built-ins
356@section Built-in commands
357 329
330@section Built-in commands
358Several commands are built-in in Eshell. In order to call the 331Several commands are built-in in Eshell. In order to call the
359external variant of a built-in command @code{foo}, you could call 332external variant of a built-in command @code{foo}, you could call
360@code{*foo}. Usually, this should not be necessary. You can check 333@code{*foo}. Usually, this should not be necessary. You can check
@@ -368,7 +341,7 @@ eshell/ls is a compiled Lisp function in `em-ls.el'
368@end example 341@end example
369 342
370If you want to discard a given built-in command, you could declare an 343If you want to discard a given built-in command, you could declare an
371alias, @ref{Aliases}. Eample: 344alias, @ref{Aliases}. Example:
372 345
373@example 346@example
374~ $ which sudo 347~ $ which sudo
@@ -378,15 +351,96 @@ eshell/sudo is a compiled Lisp function in `em-unix.el'
378sudo is an alias, defined as "*sudo $*" 351sudo is an alias, defined as "*sudo $*"
379@end example 352@end example
380 353
381Some of the built-in commands have a special behavior in Eshell: 354@vindex eshell-prefer-lisp-functions
355If you would prefer to use the built-in commands instead of the external
356commands, set @var{eshell-prefer-lisp-functions} to @code{t}.
357
358Some of the built-in commands have different behaviour from their
359external counterparts, and some have no external counterpart. Most of
360these will print a usage message when given the @code{--help} option.
382 361
383@table @code 362@table @code
384 363
364@item addpath
365@cmindex addpath
366Adds a given path or set of paths to the PATH environment variable, or,
367with no arguments, prints the current paths in this variable.
368
369@item alias
370@cmindex alias
371Define an alias (@pxref{Aliases}). This does not add it to the aliases
372file.
373
374@item date
375@cmindex date
376Similar to, but slightly different from, the GNU Coreutils
377@command{date} command.
378
379@item define
380@cmindex define
381Define a varalias. @xref{Variable Aliases, , , elisp}.
382
383@item diff
384@cmindex diff
385Use Emacs's internal @code{diff} (not to be confused with
386@code{ediff}). @xref{Comparing Files, , , elisp}.
387
388@item grep
389@cmindex grep
390@itemx agrep
391@cmindex agrep
392@itemx egrep
393@cmindex egrep
394@itemx fgrep
395@cmindex fgrep
396@itemx glimpse
397@cmindex glimpse
398The @command{grep} commands are compatible with GNU @command{grep}, but
399use Emacs's internal @code{grep} instead.
400
401@item info
402@cmindex info
403Same as the external @command{info} command, but uses Emacs's internal
404Info reader.
405
406@item jobs
407@cmindex jobs
408List subprocesses of the Emacs process, if any, using the function
409@code{list-processes}.
410
411@item kill
412@cmindex kill
413Kill processes. Takes a PID or a process object and an optional
414signal specifier.
415
416@item listify
417@cmindex listify
418Eshell version of @code{list}. Allows you to create a list using Eshell
419syntax, rather than Elisp syntax. For example, @samp{listify foo bar}
420and @code{("foo" "bar")} both evaluate to @code{("foo" "bar")}.
421
422@item locate
423@cmindex locate
424Alias to Emacs's @code{locate} function, which simply runs the external
425@command{locate} command and parses the results. @xref{Dired and `find', , , elisp}.
426
427@item make
428@cmindex make
429Run @command{make} through @code{compile}. @xref{Running Compilations under Emacs, , , elisp}.
430
431@item occur
432@cmindex occur
433Alias to Emacs's @code{occur}. @xref{Other Search-and-Loop Commands, , , elisp}.
434
435@item printnl
436@cmindex printnl
437Print the arguments separated by newlines.
438
385@item cd 439@item cd
386@findex cd 440@cmindex cd
387This command changes the current working directory. Usually, it is 441This command changes the current working directory. Usually, it is
388invoked as @samp{cd foo} where @file{foo} is the new working 442invoked as @samp{cd foo} where @file{foo} is the new working directory.
389directory. But @code{cd} knows about a few special arguments: 443But @command{cd} knows about a few special arguments:
390 444
391When it receives no argument at all, it changes to the home directory. 445When it receives no argument at all, it changes to the home directory.
392 446
@@ -396,14 +450,73 @@ directory (this is the same as @samp{cd $-}).
396The command @samp{cd =} shows the directory stack. Each line is 450The command @samp{cd =} shows the directory stack. Each line is
397numbered. 451numbered.
398 452
399With @samp{cd =foo}, Eshell searches the directory stack for a 453With @samp{cd =foo}, Eshell searches the directory stack for a directory
400directory matching the regular expression @samp{foo} and changes to 454matching the regular expression @samp{foo} and changes to that
401that directory. 455directory.
402 456
403With @samp{cd -42}, you can access the directory stack by number. 457With @samp{cd -42}, you can access the directory stack by number.
404 458
405@item history 459@item su
406@findex history 460@cmindex su
461@itemx sudo
462@cmindex sudo
463Uses TRAMP's @command{su} or @command{sudo} method to run a command via
464@command{su} or @command{sudo}.
465
466@end table
467
468@section Built-in variables
469Eshell knows a few built-in variables:
470
471@table @code
472
473@item $+
474@vindex $+
475This variable always contains the current working directory.
476
477@item $-
478@vindex $-
479This variable always contains the previous working directory (the
480current working directory from before the last @code{cd} command).
481
482@item $_
483@vindex $_
484It refers to the last argument of the last command.
485
486@item $$
487@vindex $$
488This is the result of the last command. In case of an external
489command, it is @code{t} or @code{nil}.
490
491@item $?
492@vindex $?
493This variable contains the exit code of the last command (0 or 1 for
494Lisp functions, based on successful completion).
495
496@end table
497
498@node Variables
499@section Variables
500Since Eshell is just an Emacs REPL@footnote{Read-Eval-Print Loop}, it
501does not have its own scope, and simply stores variables the same you
502would in an Elisp program. Eshell provides a command version of
503@code{setq} for convenience.
504
505@node Aliases
506@section Aliases
507
508Aliases are commands that expand to a longer input line. For example,
509@command{ll} is a common alias for @code{ls -l}, and would be defined
510with the command invocation @samp{alias ll ls -l}; with this defined,
511running @samp{ll foo} in Eshell will actually run @samp{ls -l foo}.
512Aliases defined (or deleted) by the @command{alias} command are
513automatically written to the file named by @var{eshell-aliases-file},
514which you can also edit directly (although you will have to manually
515reload it).
516
517@node History
518@section History
519@cmindex history
407The @samp{history} command shows all commands kept in the history ring 520The @samp{history} command shows all commands kept in the history ring
408as numbered list. If the history ring contains 521as numbered list. If the history ring contains
409@code{eshell-history-size} commands, those numbers change after every 522@code{eshell-history-size} commands, those numbers change after every
@@ -419,70 +532,226 @@ of the history ring.
419argument of the last command beginning with @code{foo} is accessible 532argument of the last command beginning with @code{foo} is accessible
420by @code{!foo:n}. 533by @code{!foo:n}.
421 534
422@item su 535The history ring is loaded from a file at the start of every session,
423@findex su 536and written back to the file at the end of every session. The file path
424@itemx sudo 537is specified in @var{eshell-history-file-name}. Unlike other shells,
425@findex sudo 538such as Bash, Eshell can not be configured to keep a history ring of a
426@code{su} and @code{sudo} work as expected: they apply the following 539different size than that of the history file.
427commands (@code{su}), or the command being an argument (@code{sudo}) 540
428under the permissions of somebody else. 541Since the default buffer navigation and searching key-bindings are
429 542still present in the Eshell buffer, the commands for history
430This does not work only on 543navigation and searching are bound to different keys:
431the local host, but even on a remote one, when 544
432@code{default-directory} is a remote file name. The necessary 545@table @kbd
433proxy configuration of Tramp is performed 546@item M-r
434@ifinfo 547@itemx M-s
435automatically, @ref{Multi-hops, , , tramp}. 548History I-search.
436@end ifinfo 549
437@ifnotinfo 550@item M-p
438automatically. 551@itemx M-n
439@end ifnotinfo 552Previous and next history line. If there is anything on the input
440Example: 553line when you run these commands, they will instead jump to the
554precious or next line that begins with that string.
555@end table
556
557@node Completion
558@section Completion
559Eshell uses the pcomplete package for programmable completion, similar
560to that of other command shells. Argument completion differs depending
561on the preceding command: for example, possible completions for
562@command{rmdir} are only directories, while @command{rm} completions can
563be directories @emph{and} files. Eshell provides predefined completions
564for the built-in functions and some common external commands, and you
565can define your own for any command.
566
567Eshell completion also works for lisp forms and glob patterns. If the
568point is on a lisp form, then @key{TAB} will behave similarly to completion
569in @code{elisp-mode} and @code{lisp-interaction-mode}. For glob
570patterns, If there are few enough possible completions of the patterns,
571they will be cycled when @key{TAB} is pressed, otherwise it will be removed
572from the input line and the possible completions will be listed.
573
574If you want to see the entire list of possible completions when it's
575below the cycling threshold, press @kbd{M-?}.
576
577@subsection pcomplete
578Pcomplete, short for programmable completion, is the completion
579library originally written for Eshell, but usable for command
580completion@footnote{Command completion as opposed to code completion,
581which is a beyond the scope of pcomplete.} in other modes.
582
583Completions are defined as functions (with @code{defun}) named
584@code{pcomplete/COMMAND}, where @code{COMMAND} is the name of the
585command for which this function provides completions; you can also name
586the function @code{pcomplete/MAJOR-MODE/COMMAND} to define completions
587for a specific major mode.
588
589@node for loop
590@section @code{for} loop
591Because Eshell commands can not (easily) be combined with lisp forms,
592Eshell provides a command-oriented @command{for}-loop for convenience.
593The syntax is as follows:
441 594
442@example 595@example
443~ $ cd /ssh:otherhost:/etc 596@code{for VAR in TOKENS @{ command invocation(s) @}}
444/ssh:user@@otherhost:/etc $ sudo find-file shadow
445@end example 597@end example
446 598
447@end table 599where @samp{TOKENS} is a space-separated sequence of values of
448 600@var{VAR} for each iteration. This can even be the output of a
601command if @samp{TOKENS} is replaced with @samp{@{ command invocation @}}.
449 602
450@node Arguments 603@node Scripts
451@chapter Arguments 604@section Scripts
605@cmindex source
606@fnindex eshell-source-file
607You can run Eshell scripts much like scripts for other shells; the main
608difference is that since Eshell is not a system command, you have to run
609it from within Emacs. An Eshell script is simply a file containing a
610sequence of commands, as with almost any other shell script. Scripts
611are invoked from Eshell with @command{source}, or from anywhere in Emacs
612with @code{eshell-source-file}.
613
614@cmindex .
615If you wish to load a script into your @emph{current} environment,
616rather than in a subshell, use the @code{.} command.
617
618@node Expansion
619@chapter Expansion
620Expansion in a command shell is somewhat like macro expansion in macro
621parsers (such as @command{cpp} and @command{m4}), but in a command
622shell, they are less often used for constants, and usually for using
623variables and string manipulation.@footnote{Eshell has no
624string-manipulation expansions because the Elisp library already
625provides many functions for this.} For example, @code{$var} on a line
626expands to the value of the variable @code{var} when the line is
627executed. Expansions are usually passed as arguments, but may also be
628used as commands.@footnote{e.g. Entering just @samp{$var} at the prompt
629is equivalent to entering the value of @code{var} at the prompt.}
452 630
453@menu 631@menu
454* The Parser:: 632* Dollars Expansion::
455* Variables::
456* Substitution::
457* Globbing:: 633* Globbing::
458* Predicates::
459@end menu 634@end menu
460 635
461@node The Parser 636@node Dollars Expansion
462@section The Parser 637@section Dollars Expansion
638Eshell has different @code{$} expansion syntax from other shells. There
639are some similarities, but don't let these lull you into a false sense
640of familiarity.
463 641
464@node Variables 642@table @code
465@section Variables
466 643
467@node Substitution 644@item $var
468@section Substitution 645Expands to the value bound to @code{var}. This is the main way to use
646variables in command invocations.
469 647
470@node Globbing 648@item $#var
471@section Globbing 649Expands to the length of the value bound to @code{var}. Raises an error
650if the value is not a sequence (@pxref{Sequences Arrays and Vectors, Sequences, , elisp}).
472 651
473@node Predicates 652@item $(lisp)
474@section Predicates 653Expands to the result of evaluating the S-expression @code{(lisp)}. On
654its own, this is identical to just @code{(lisp)}, but with the @code{$},
655it can be used in a string, such as @samp{/some/path/$(lisp).txt}.
475 656
657@item $@{command@}
658Returns the output of @command{command}, which can be any valid Eshell
659command invocation, and may even contain expansions.
476 660
477@node Input/Output 661@item $var[i]
478@chapter Input/Output 662Expands to the @code{i}th element of the value bound to @code{var}. If
663the value is a string, it will be split at whitespace to make it a list.
664Again, raises an error if the value is not a sequence.
665
666@item $var[: i]
667As above, but now splitting occurs at the colon character.
479 668
480@node Process control 669@item $var[: i j]
481@chapter Process control 670As above, but instead of returning just a string, it now returns a list
671of two strings. If the result is being interpolated into a larger
672string, this list will be flattened into one big string, with each
673element separated by a space.
482 674
675@item $var["\\\\" i]
676Separate on backslash characters. Actually, the first argument -- if it
677doesn't have the form of a number, or a plain variable name -- can be
678any regular expression. So to split on numbers, use @samp{$var["[0-9]+" 10 20]}.
679
680@item $var[hello]
681Calls @code{assoc} on @code{var} with @code{"hello"}, expecting it to be
682an alist (@pxref{Association List Type, Association Lists, , elisp}).
683
684@item $#var[hello]
685Returns the length of the cdr of the element of @code{var} who car is equal
686to @code{"hello"}.
687
688@end table
689
690@node Globbing
691@section Globbing
692Eshell's globbing syntax is very similar to that of Zsh. Users coming
693from Bash can still use Bash-style globbing, as there are no
694incompatibilities. Most globbing is pattern-based expansion, but there
695is also predicate-based expansion. See @ref{Filename Generation, , , zsh}
696for full syntax. To customize the syntax and behaviour of globbing in
697Eshell see the Customize@footnote{@xref{Customization Settings, Customize, , elisp}.}
698groups ``eshell-glob'' and ``eshell-pred''.
699
700@node Input/Output
701@chapter Input/Output
702Since Eshell does not communicate with a terminal like most command
703shells, IO is a little different. If you try to run programs from
704within Eshell that are not line-oriented, such as programs that use
705ncurses, you will just get garbage output, since the Eshell buffer is
706not a terminal emulator. Eshell solves this problem by running
707specified commands in Emacs's terminal emulator; to let Eshell know
708which commands need to be run in a terminal, add them to the list
709@var{eshell-visual-commands}.
710
711Redirection is mostly the same in Eshell as it is in other command
712shells. The output redirection operators @code{>} and @code{>>} as well
713as pipes are supported, but there is not yet any support for input
714redirection. Output can also be redirected to Elisp functions, using
715virtual devices.
716
717@var{eshell-virtual-targets} is a list of mappings of virtual device
718names to functions. Eshell comes with two virtual devices:
719@file{/dev/kill}, which sends the text to the kill ring, and
720@file{/dev/clip}, which sends text to the clipboard.
721
722You can, of course, define your own virtual targets. They are defined
723by adding a list of the form @code{("/dev/name" function mode)} to
724@var{eshell-virtual-targets}. The first element is the device name;
725@code{function} may be either a lambda or a function name. If
726@code{mode} is nil, then the function is the output function; if it is
727non-nil, then the function is passed the redirection mode as a
728symbol--@code{overwrite}, @code{append}, or @code{insert}--and the
729function is expected to return the output function.
730
731The output function is called once on each line of output until
732@code{nil} is passed, indicating end of output.
483 733
484@node Extension modules 734@node Extension modules
485@chapter Extension modules 735@chapter Extension modules
736Eshell provides a facility for defining extension modules so that they
737can be disabled and enabled without having to unload and reload them,
738and to provide a common parent Customize group for the
739modules.@footnote{ERC provides a similar module facility.} An Eshell
740module is defined the same as any other library but one requirement: the
741module must define a Customize@footnote{@xref{Customization Settings, Customize, , elisp}.}
742group using @code{eshell-defgroup} (in place of @code{defgroup}) with
743@code{eshell-module} as the parent group.@footnote{If the module has
744no user-customizable options, then there is no need to define it as an
745Eshell module.} You also need to load the following as shown:
746
747@example
748(eval-when-compile
749 (require 'cl)
750 (require 'esh-mode)
751 (require 'eshell))
752
753(require 'esh-util)
754@end example
486 755
487@menu 756@menu
488* Writing a module:: 757* Writing a module::
@@ -491,7 +760,6 @@ Example:
491* Key rebinding:: 760* Key rebinding::
492* Smart scrolling:: 761* Smart scrolling::
493* Terminal emulation:: 762* Terminal emulation::
494* Built-in UNIX commands::
495@end menu 763@end menu
496 764
497@node Writing a module 765@node Writing a module
@@ -512,13 +780,6 @@ Example:
512@node Terminal emulation 780@node Terminal emulation
513@section Terminal emulation 781@section Terminal emulation
514 782
515@node Built-in UNIX commands
516@section Built-in UNIX commands
517
518
519@node Extras and Goodies
520@chapter Extras and Goodies
521
522@node Bugs and ideas 783@node Bugs and ideas
523@chapter Bugs and ideas 784@chapter Bugs and ideas
524@cindex reporting bugs and ideas 785@cindex reporting bugs and ideas
@@ -527,6 +788,8 @@ Example:
527@cindex email to the author 788@cindex email to the author
528@cindex FAQ 789@cindex FAQ
529@cindex problems, list of common 790@cindex problems, list of common
791@cindex known bugs
792@cindex bugs, known
530 793
531If you find a bug or misfeature, don't hesitate to let me know! Send 794If you find a bug or misfeature, don't hesitate to let me know! Send
532email to @email{johnw@@gnu.org}. Feature requests should also be sent 795email to @email{johnw@@gnu.org}. Feature requests should also be sent
@@ -537,16 +800,7 @@ If you have ideas for improvements, or if you have written some
537extensions to this package, I would like to hear from you. I hope you 800extensions to this package, I would like to hear from you. I hope you
538find this package useful! 801find this package useful!
539 802
540@menu 803Below is a complete list of known problems with Eshell version 2.4.2,
541* Known problems::
542@end menu
543
544@node Known problems
545@section Known problems
546@cindex known bugs
547@cindex bugs, known
548
549Below is complete list of known problems with Eshell version 2.4.2,
550which is the version included with Emacs 22. 804which is the version included with Emacs 22.
551 805
552@table @asis 806@table @asis
@@ -554,7 +808,7 @@ which is the version included with Emacs 22.
554 808
555@item Differentiate between aliases and functions 809@item Differentiate between aliases and functions
556 810
557Allow for a bash-compatible syntax, such as: 811Allow for a Bash-compatible syntax, such as:
558 812
559@example 813@example
560alias arg=blah 814alias arg=blah
@@ -838,7 +1092,7 @@ them; @code{min} would display the smallest figure, etc.
838It would provide syntax, abbrev, highlighting and indenting support like 1092It would provide syntax, abbrev, highlighting and indenting support like
839@code{emacs-lisp-mode} and @code{shell-mode}. 1093@code{emacs-lisp-mode} and @code{shell-mode}.
840 1094
841@item In the history mechanism, finish the @command{bash}-style support 1095@item In the history mechanism, finish the Bash-style support
842 1096
843This means @samp{!n}, @samp{!#}, @samp{!:%}, and @samp{!:1-} as separate 1097This means @samp{!n}, @samp{!#}, @samp{!:%}, and @samp{!:1-} as separate
844from @samp{!:1*}. 1098from @samp{!:1*}.
@@ -1008,6 +1262,11 @@ Since it keeps the cursor up where the command was invoked.
1008 1262
1009@printindex fn 1263@printindex fn
1010 1264
1265@node Command Index
1266@unnumbered Command Index
1267
1268@printindex cm
1269
1011@node Key Index 1270@node Key Index
1012@unnumbered Key Index 1271@unnumbered Key Index
1013 1272
diff --git a/etc/TODO b/etc/TODO
index cf67140a10c..4f7b8dc5f0c 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -269,18 +269,11 @@ specified filters, specified timers, and specified hooks.
269 269
270* Other features we would like: 270* Other features we would like:
271 271
272** Make longlines-mode wrap lines based on screen position instead
273 of character position, so that variable-width fonts can be handled
274 properly.
275
276** Allow frames(terminals) created by emacsclient to inherit their environment 272** Allow frames(terminals) created by emacsclient to inherit their environment
277from the emacsclient process. 273from the emacsclient process.
278** Remove the default toggling behavior of minor modes when called from elisp 274** Remove the default toggling behavior of minor modes when called from elisp
279rather than interactively. This a trivial one-liner in easy-mode.el. 275rather than interactively. This a trivial one-liner in easy-mode.el.
280 276
281** Create a category of errors called `user-error' for errors which are
282typically due to pilot errors and should thus be in debug-ignored-errors.
283
284** Give Tar mode all the features of Archive mode. 277** Give Tar mode all the features of Archive mode.
285 278
286** Create a category of errors called `process-error' 279** Create a category of errors called `process-error'
diff --git a/leim/ChangeLog b/leim/ChangeLog
index b07102d44ba..b6591afb75f 100644
--- a/leim/ChangeLog
+++ b/leim/ChangeLog
@@ -1,3 +1,7 @@
12013-02-08 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * quail/latin-ltx.el: Add greek superscripts.
4
12012-12-04 Stefan Monnier <monnier@iro.umontreal.ca> 52012-12-04 Stefan Monnier <monnier@iro.umontreal.ca>
2 6
3 * quail/latin-ltx.el: Avoid deprecated chars for \langle and \rangle. 7 * quail/latin-ltx.el: Avoid deprecated chars for \langle and \rangle.
diff --git a/leim/quail/latin-ltx.el b/leim/quail/latin-ltx.el
index e686d7bc04b..2179e6264a2 100644
--- a/leim/quail/latin-ltx.el
+++ b/leim/quail/latin-ltx.el
@@ -248,14 +248,18 @@ system, including many technical ones. Examples:
248 (string (if (match-end 2) ?^ ?_) basechar)))) 248 (string (if (match-end 2) ?^ ?_) basechar))))
249 "\\(.*\\)SU\\(?:B\\|\\(PER\\)\\)SCRIPT \\(.*\\)") 249 "\\(.*\\)SU\\(?:B\\|\\(PER\\)\\)SCRIPT \\(.*\\)")
250 250
251 ("^\\gamma" ?Ë )
252
253 ((lambda (name char) 251 ((lambda (name char)
254 (let* ((base (format "LATIN %s LETTER %s" 252 (let* ((basename (match-string 2 name))
255 (match-string 1 name) (match-string 2 name))) 253 (lbase (format "LATIN %s LETTER %s"
256 (basechar (cdr (assoc base (ucs-names))))) 254 (match-string 1 name) basename))
257 (when (latin-ltx--ascii-p basechar) 255 (gbase (format "GREEK %s LETTER %s"
258 (string ?^ basechar)))) 256 (match-string 1 name) basename))
257 tmp)
258 (cond
259 ((assoc gbase (ucs-names)) (concat "^\\" (downcase basename)))
260 ((latin-ltx--ascii-p (setq tmp (cdr (assoc lbase (ucs-names)))))
261 (string ?^ tmp))
262 (t (message "Unknown modifier letter %s" basename)))))
259 "MODIFIER LETTER \\(SMALL\\|CAPITAL\\) \\(.*\\)") 263 "MODIFIER LETTER \\(SMALL\\|CAPITAL\\) \\(.*\\)")
260 264
261 ;; ((lambda (name char) (format "^%s" (downcase (match-string 1 name)))) 265 ;; ((lambda (name char) (format "^%s" (downcase (match-string 1 name))))
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4211901d64f..3dea3ed0380 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,26 @@
12013-02-08 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/byte-run.el (eval-when-compile, eval-and-compile):
4 Eval body right away, now that we do eager macroexpansion (bug#13605).
5
6 * simple.el (end-of-buffer): Don't touch unrelated windows (bug#13466).
7 (fundamental-mode): Use run-mode-hooks.
8
9 * eshell/esh-proc.el (eshell/kill): Fix last change.
10 * eshell/em-ls.el (eshell-ls-dir): Fix use of CL in last change.
11
122013-02-08 Aidan Gauland <aidalgol@no8wireless.co.nz>
13
14 * eshell/esh-proc.el (eshell/kill): Rewrite.
15
16 * eshell/em-ls.el (show-almost-all): Declare.
17 (eshell-do-ls): Add support for -A argument.
18
192013-02-08 Jambunathan K <kjambunathan@gmail.com>
20
21 * icomplete.el (icomplete-forward-completions)
22 (icomplete-backward-completions): Handle corner case (bug#13602).
23
12013-02-07 Michael Albinus <michael.albinus@gmx.de> 242013-02-07 Michael Albinus <michael.albinus@gmx.de>
2 25
3 * vc/vc-hooks.el (vc-find-file-hook): `buffer-file-truename' can 26 * vc/vc-hooks.el (vc-find-file-hook): `buffer-file-truename' can
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index b44ec68e2bf..48bcefaee1a 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -392,15 +392,15 @@ If you think you need this, you're probably making a mistake somewhere."
392Thus, the result of the body appears to the compiler as a quoted constant. 392Thus, the result of the body appears to the compiler as a quoted constant.
393In interpreted code, this is entirely equivalent to `progn'." 393In interpreted code, this is entirely equivalent to `progn'."
394 (declare (debug t) (indent 0)) 394 (declare (debug t) (indent 0))
395 ;; Not necessary because we have it in b-c-initial-macro-environment 395 (list 'quote (eval (cons 'progn body) lexical-binding)))
396 ;; (list 'quote (eval (cons 'progn body)))
397 (cons 'progn body))
398 396
399(defmacro eval-and-compile (&rest body) 397(defmacro eval-and-compile (&rest body)
400 "Like `progn', but evaluates the body at compile time and at load time." 398 "Like `progn', but evaluates the body at compile time and at load time."
401 (declare (debug t) (indent 0)) 399 (declare (debug t) (indent 0))
402 ;; Remember, it's magic. 400 ;; When the byte-compiler expands code, this macro is not used, so we're
403 (cons 'progn body)) 401 ;; either about to run `body' (plain interpretation) or we're doing eager
402 ;; macroexpansion.
403 (list 'quote (eval (cons 'progn body) lexical-binding)))
404 404
405(put 'with-no-warnings 'lisp-indent-function 0) 405(put 'with-no-warnings 'lisp-indent-function 0)
406(defun with-no-warnings (&rest body) 406(defun with-no-warnings (&rest body)
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index eec932103ee..73ed617b871 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -26,9 +26,8 @@
26 26
27;;; Code: 27;;; Code:
28 28
29(eval-when-compile 29(eval-when-compile (require 'eshell))
30 (require 'cl-lib) 30(require 'cl-lib)
31 (require 'eshell))
32(require 'esh-util) 31(require 'esh-util)
33(require 'esh-opt) 32(require 'esh-opt)
34 33
@@ -328,6 +327,7 @@ instead."
328(defvar numeric-uid-gid) 327(defvar numeric-uid-gid)
329(defvar reverse-list) 328(defvar reverse-list)
330(defvar show-all) 329(defvar show-all)
330(defvar show-almost-all)
331(defvar show-recursive) 331(defvar show-recursive)
332(defvar show-size) 332(defvar show-size)
333(defvar sort-method) 333(defvar sort-method)
@@ -337,13 +337,15 @@ instead."
337(defun eshell-do-ls (&rest args) 337(defun eshell-do-ls (&rest args)
338 "Implementation of \"ls\" in Lisp, passing ARGS." 338 "Implementation of \"ls\" in Lisp, passing ARGS."
339 (funcall flush-func -1) 339 (funcall flush-func -1)
340 ;; process the command arguments, and begin listing files 340 ;; Process the command arguments, and begin listing files.
341 (eshell-eval-using-options 341 (eshell-eval-using-options
342 "ls" (if eshell-ls-initial-args 342 "ls" (if eshell-ls-initial-args
343 (list eshell-ls-initial-args args) 343 (list eshell-ls-initial-args args)
344 args) 344 args)
345 `((?a "all" nil show-all 345 `((?a "all" nil show-all
346 "show all files in directory") 346 "do not ignore entries starting with .")
347 (?A "almost-all" nil show-almost-all
348 "do not list implied . and ..")
347 (?c nil by-ctime sort-method 349 (?c nil by-ctime sort-method
348 "sort by last status change time") 350 "sort by last status change time")
349 (?d "directory" nil dir-literal 351 (?d "directory" nil dir-literal
@@ -558,7 +560,15 @@ relative to that directory."
558 ;; later when we are going to 560 ;; later when we are going to
559 ;; display user and group names. 561 ;; display user and group names.
560 (if numeric-uid-gid 'integer 'string)))) 562 (if numeric-uid-gid 'integer 'string))))
561 (when (and (not show-all) eshell-ls-exclude-regexp) 563 (when (and show-almost-all
564 (not show-all))
565 (setq entries
566 (cl-remove-if
567 (lambda (entry)
568 (member (caar entry) '("." "..")))
569 entries)))
570 (when (and (not show-all)
571 eshell-ls-exclude-regexp)
562 (while (and entries (string-match eshell-ls-exclude-regexp 572 (while (and entries (string-match eshell-ls-exclude-regexp
563 (caar entries))) 573 (caar entries)))
564 (setq entries (cdr entries))) 574 (setq entries (cdr entries)))
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 406822367d1..aa630dc87aa 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -165,43 +165,38 @@ The signals which will cause this to happen are matched by
165 (list-processes))) 165 (list-processes)))
166 166
167(defun eshell/kill (&rest args) 167(defun eshell/kill (&rest args)
168 "Kill processes, buffers, symbol or files." 168 "Kill processes.
169 (let ((ptr args) 169Usage: kill [-<signal>] <pid>|<process> ...
170 (signum 'SIGINT)) 170Accepts PIDs and process objects."
171 (while ptr 171 ;; If the first argument starts with a dash, treat it as the signal
172 (if (or (eshell-processp (car ptr)) 172 ;; specifier.
173 (and (stringp (car ptr)) 173 (let ((signum 'SIGINT))
174 (string-match "^[A-Za-z/][A-Za-z0-9<>/]+$" 174 (let ((arg (car args))
175 (car ptr)))) 175 (case-fold-search nil))
176 ;; What about when $lisp-variable is possible here? 176 (when (stringp arg)
177 ;; It could very well name a process. 177 (cond
178 (setcar ptr (get-process (car ptr)))) 178 ((string-match "\\`-[[:digit:]]+\\'" arg)
179 (setq ptr (cdr ptr))) 179 (setq signum (abs (string-to-number arg))))
180 ((string-match "\\`-\\([[:upper:]]+\\|[[:lower:]]+\\)\\'" arg)
181 (setq signum (abs (string-to-number arg)))))
182 (setq args (cdr args))))
180 (while args 183 (while args
181 (let ((id (if (eshell-processp (car args)) 184 (let ((arg (if (eshell-processp (car args))
182 (process-id (car args)) 185 (process-id (car args))
183 (car args)))) 186 (car args))))
184 (when id 187 (when arg
185 (cond 188 (cond
186 ((null id) 189 ((null arg)
187 (error "kill: bad signal spec")) 190 (error "kill: null pid. Process may actually be a network connection."))
188 ((and (numberp id) (= id 0)) 191 ((not (numberp arg))
189 (error "kill: bad signal spec `%d'" id)) 192 (error "kill: invalid argument type: %s" (type-of arg)))
190 ((and (stringp id) 193 ((and (numberp arg)
191 (string-match "^-?[0-9]+$" id)) 194 (<= arg 0))
192 (setq signum (abs (string-to-number id)))) 195 (error "kill: bad pid: %d" arg))
193 ((stringp id) 196 (t
194 (let (case-fold-search) 197 (signal-process arg signum)))))
195 (if (string-match "^-\\([A-Z]+[12]?\\)$" id) 198 (setq args (cdr args))))
196 (setq signum 199 nil)
197 (intern (concat "SIG" (match-string 1 id))))
198 (error "kill: bad signal spec `%s'" id))))
199 ((< id 0)
200 (setq signum (abs id)))
201 (t
202 (signal-process id signum)))))
203 (setq args (cdr args)))
204 nil))
205 200
206(defun eshell-read-process-name (prompt) 201(defun eshell-read-process-name (prompt)
207 "Read the name of a process from the minibuffer, using completion. 202 "Read the name of a process from the minibuffer, using completion.
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 9407de4f6d9..8e4dd69e199 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -167,8 +167,9 @@ Second entry becomes the first and can be selected with
167 (interactive) 167 (interactive)
168 (let* ((comps (completion-all-sorted-completions)) 168 (let* ((comps (completion-all-sorted-completions))
169 (last (last comps))) 169 (last (last comps)))
170 (setcdr last (cons (car comps) (cdr last))) 170 (when comps
171 (completion--cache-all-sorted-completions (cdr comps)))) 171 (setcdr last (cons (car comps) (cdr last)))
172 (completion--cache-all-sorted-completions (cdr comps)))))
172 173
173(defun icomplete-backward-completions () 174(defun icomplete-backward-completions ()
174 "Step backward completions by one entry. 175 "Step backward completions by one entry.
@@ -178,7 +179,7 @@ Last entry becomes the first and can be selected with
178 (let* ((comps (completion-all-sorted-completions)) 179 (let* ((comps (completion-all-sorted-completions))
179 (last-but-one (last comps 2)) 180 (last-but-one (last comps 2))
180 (last (cdr last-but-one))) 181 (last (cdr last-but-one)))
181 (when last 182 (when (consp last) ; At least two elements in comps
182 (setcdr last-but-one (cdr last)) 183 (setcdr last-but-one (cdr last))
183 (push (car last) comps) 184 (push (car last) comps)
184 (completion--cache-all-sorted-completions comps)))) 185 (completion--cache-all-sorted-completions comps))))
diff --git a/lisp/simple.el b/lisp/simple.el
index d7541f68778..9587d3c006c 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -349,8 +349,7 @@ buffer causes automatic display of the corresponding source code location."
349Other major modes are defined by comparison with this one." 349Other major modes are defined by comparison with this one."
350 (interactive) 350 (interactive)
351 (kill-all-local-variables) 351 (kill-all-local-variables)
352 (unless delay-mode-hooks 352 (run-mode-hooks))
353 (run-hooks 'after-change-major-mode-hook)))
354 353
355;; Special major modes to view specially formatted data rather than files. 354;; Special major modes to view specially formatted data rather than files.
356 355
@@ -868,7 +867,8 @@ Don't use this command in Lisp programs!
868 ;; If we went to a place in the middle of the buffer, 867 ;; If we went to a place in the middle of the buffer,
869 ;; adjust it to the beginning of a line. 868 ;; adjust it to the beginning of a line.
870 (cond ((and arg (not (consp arg))) (forward-line 1)) 869 (cond ((and arg (not (consp arg))) (forward-line 1))
871 ((> (point) (window-end nil t)) 870 ((and (eq (current-buffer) (window-buffer))
871 (> (point) (window-end nil t)))
872 ;; If the end of the buffer is not already on the screen, 872 ;; If the end of the buffer is not already on the screen,
873 ;; then scroll specially to put it near, but not at, the bottom. 873 ;; then scroll specially to put it near, but not at, the bottom.
874 (overlay-recenter (point)) 874 (overlay-recenter (point))
diff --git a/src/ChangeLog b/src/ChangeLog
index 9ffe133e758..46f872ba29d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,38 @@
12013-02-08 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * lread.c (skip_dyn_bytes): New function (bug#12598).
4 (read1): Use it. Use getc instead of READCHAR to read bytes.
5 (load_each_byte): Remove. Update users.
6
72013-02-08 Dmitry Antipov <dmantipov@yandex.ru>
8
9 * search.c (scan_buffer): Calculate end byte position just once.
10 (scan_newline): Do not recalculate start_byte.
11 (search_command): Use eassert.
12 * syntax.c (struct lisp_parse_state): New member location_byte.
13 (scan_sexps_forward): Record from_byte and avoid redundant
14 character to byte position calculation ...
15 (Fparse_partial_sexp): ... here. Break too long line.
16
172013-02-08 Dmitry Antipov <dmantipov@yandex.ru>
18
19 * lisp.h (make_uninit_vector): New function.
20 * alloc.c (Fvector, Fmake_byte_code):
21 * ccl.c (Fregister_ccl_program):
22 * charset.c (Fdefine_charset_internal, define_charset_internal):
23 * coding.c (make_subsidiaries, Fdefine_coding_system_internal):
24 * composite.c (syms_of_composite):
25 * font.c (Fquery_font, Ffont_info, syms_of_font):
26 * fontset.c (FONT_DEF_NEW, Fset_fontset_font):
27 * ftfont.c (ftfont_shape_by_flt):
28 * indent.c (recompute_width_table):
29 * nsselect.m (clean_local_selection_data):
30 * syntax.c (init_syntax_once):
31 * w32unsubscribe.c (uniscribe_shape):
32 * window.c (Fcurrent_window_configuration):
33 * xfaces.c (Fx_family_fonts):
34 * xselect.c (selection_data_to_lisp_data): Use it.
35
12013-02-07 Dmitry Antipov <dmantipov@yandex.ru> 362013-02-07 Dmitry Antipov <dmantipov@yandex.ru>
2 37
3 * coding.c (Fdefine_coding_system_internal): Use AREF where 38 * coding.c (Fdefine_coding_system_internal): Use AREF where
diff --git a/src/alloc.c b/src/alloc.c
index 2624650ed2c..80086433e65 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3105,13 +3105,10 @@ Any number of arguments, even zero arguments, are allowed.
3105usage: (vector &rest OBJECTS) */) 3105usage: (vector &rest OBJECTS) */)
3106 (ptrdiff_t nargs, Lisp_Object *args) 3106 (ptrdiff_t nargs, Lisp_Object *args)
3107{ 3107{
3108 register Lisp_Object len, val;
3109 ptrdiff_t i; 3108 ptrdiff_t i;
3110 register struct Lisp_Vector *p; 3109 register Lisp_Object val = make_uninit_vector (nargs);
3110 register struct Lisp_Vector *p = XVECTOR (val);
3111 3111
3112 XSETFASTINT (len, nargs);
3113 val = Fmake_vector (len, Qnil);
3114 p = XVECTOR (val);
3115 for (i = 0; i < nargs; i++) 3112 for (i = 0; i < nargs; i++)
3116 p->contents[i] = args[i]; 3113 p->contents[i] = args[i];
3117 return val; 3114 return val;
@@ -3149,9 +3146,9 @@ stack before executing the byte-code.
3149usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) 3146usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */)
3150 (ptrdiff_t nargs, Lisp_Object *args) 3147 (ptrdiff_t nargs, Lisp_Object *args)
3151{ 3148{
3152 register Lisp_Object len, val;
3153 ptrdiff_t i; 3149 ptrdiff_t i;
3154 register struct Lisp_Vector *p; 3150 register Lisp_Object val = make_uninit_vector (nargs);
3151 register struct Lisp_Vector *p = XVECTOR (val);
3155 3152
3156 /* We used to purecopy everything here, if purify-flag was set. This worked 3153 /* We used to purecopy everything here, if purify-flag was set. This worked
3157 OK for Emacs-23, but with Emacs-24's lexical binding code, it can be 3154 OK for Emacs-23, but with Emacs-24's lexical binding code, it can be
@@ -3161,10 +3158,6 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
3161 just wasteful and other times plainly wrong (e.g. those free vars may want 3158 just wasteful and other times plainly wrong (e.g. those free vars may want
3162 to be setcar'd). */ 3159 to be setcar'd). */
3163 3160
3164 XSETFASTINT (len, nargs);
3165 val = Fmake_vector (len, Qnil);
3166
3167 p = XVECTOR (val);
3168 for (i = 0; i < nargs; i++) 3161 for (i = 0; i < nargs; i++)
3169 p->contents[i] = args[i]; 3162 p->contents[i] = args[i];
3170 make_byte_code (p); 3163 make_byte_code (p);
diff --git a/src/ccl.c b/src/ccl.c
index 9bfd437d885..7f77e1d22fa 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -2228,9 +2228,8 @@ Return index number of the registered CCL program. */)
2228 Vccl_program_table = larger_vector (Vccl_program_table, 1, -1); 2228 Vccl_program_table = larger_vector (Vccl_program_table, 1, -1);
2229 2229
2230 { 2230 {
2231 Lisp_Object elt; 2231 Lisp_Object elt = make_uninit_vector (4);
2232 2232
2233 elt = Fmake_vector (make_number (4), Qnil);
2234 ASET (elt, 0, name); 2233 ASET (elt, 0, name);
2235 ASET (elt, 1, ccl_prog); 2234 ASET (elt, 1, ccl_prog);
2236 ASET (elt, 2, resolved); 2235 ASET (elt, 2, resolved);
diff --git a/src/charset.c b/src/charset.c
index c3a4538f223..fdb8eebde8b 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1053,7 +1053,7 @@ usage: (define-charset-internal ...) */)
1053 CHECK_NATNUM (parent_max_code); 1053 CHECK_NATNUM (parent_max_code);
1054 parent_code_offset = Fnth (make_number (3), val); 1054 parent_code_offset = Fnth (make_number (3), val);
1055 CHECK_NUMBER (parent_code_offset); 1055 CHECK_NUMBER (parent_code_offset);
1056 val = Fmake_vector (make_number (4), Qnil); 1056 val = make_uninit_vector (4);
1057 ASET (val, 0, make_number (parent_charset->id)); 1057 ASET (val, 0, make_number (parent_charset->id));
1058 ASET (val, 1, parent_min_code); 1058 ASET (val, 1, parent_min_code);
1059 ASET (val, 2, parent_max_code); 1059 ASET (val, 2, parent_max_code);
@@ -1259,7 +1259,7 @@ define_charset_internal (Lisp_Object name,
1259 1259
1260 args[charset_arg_name] = name; 1260 args[charset_arg_name] = name;
1261 args[charset_arg_dimension] = make_number (dimension); 1261 args[charset_arg_dimension] = make_number (dimension);
1262 val = Fmake_vector (make_number (8), make_number (0)); 1262 val = make_uninit_vector (8);
1263 for (i = 0; i < 8; i++) 1263 for (i = 0; i < 8; i++)
1264 ASET (val, i, make_number (code_space[i])); 1264 ASET (val, i, make_number (code_space[i]));
1265 args[charset_arg_code_space] = val; 1265 args[charset_arg_code_space] = val;
diff --git a/src/coding.c b/src/coding.c
index c7bfe25e0cc..b881f162ab9 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -9483,7 +9483,7 @@ make_subsidiaries (Lisp_Object base)
9483 int i; 9483 int i;
9484 9484
9485 memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len); 9485 memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len);
9486 subsidiaries = Fmake_vector (make_number (3), Qnil); 9486 subsidiaries = make_uninit_vector (3);
9487 for (i = 0; i < 3; i++) 9487 for (i = 0; i < 3; i++)
9488 { 9488 {
9489 strcpy (buf + base_name_len, suffixes[i]); 9489 strcpy (buf + base_name_len, suffixes[i]);
@@ -9988,7 +9988,8 @@ usage: (define-coding-system-internal ...) */)
9988 this_name = AREF (eol_type, i); 9988 this_name = AREF (eol_type, i);
9989 this_aliases = Fcons (this_name, Qnil); 9989 this_aliases = Fcons (this_name, Qnil);
9990 this_eol_type = (i == 0 ? Qunix : i == 1 ? Qdos : Qmac); 9990 this_eol_type = (i == 0 ? Qunix : i == 1 ? Qdos : Qmac);
9991 this_spec = Fmake_vector (make_number (3), attrs); 9991 this_spec = make_uninit_vector (3);
9992 ASET (this_spec, 0, attrs);
9992 ASET (this_spec, 1, this_aliases); 9993 ASET (this_spec, 1, this_aliases);
9993 ASET (this_spec, 2, this_eol_type); 9994 ASET (this_spec, 2, this_eol_type);
9994 Fputhash (this_name, this_spec, Vcoding_system_hash_table); 9995 Fputhash (this_name, this_spec, Vcoding_system_hash_table);
@@ -10001,7 +10002,8 @@ usage: (define-coding-system-internal ...) */)
10001 } 10002 }
10002 } 10003 }
10003 10004
10004 spec_vec = Fmake_vector (make_number (3), attrs); 10005 spec_vec = make_uninit_vector (3);
10006 ASET (spec_vec, 0, attrs);
10005 ASET (spec_vec, 1, aliases); 10007 ASET (spec_vec, 1, aliases);
10006 ASET (spec_vec, 2, eol_type); 10008 ASET (spec_vec, 2, eol_type);
10007 10009
diff --git a/src/composite.c b/src/composite.c
index ddd92389725..54cebc00eb7 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1958,7 +1958,7 @@ syms_of_composite (void)
1958 } 1958 }
1959 1959
1960 staticpro (&gstring_work_headers); 1960 staticpro (&gstring_work_headers);
1961 gstring_work_headers = Fmake_vector (make_number (8), Qnil); 1961 gstring_work_headers = make_uninit_vector (8);
1962 for (i = 0; i < 8; i++) 1962 for (i = 0; i < 8; i++)
1963 ASET (gstring_work_headers, i, Fmake_vector (make_number (i + 2), Qnil)); 1963 ASET (gstring_work_headers, i, Fmake_vector (make_number (i + 2), Qnil));
1964 staticpro (&gstring_work); 1964 staticpro (&gstring_work);
diff --git a/src/doc.c b/src/doc.c
index 16c0d4090a0..fa2eca66a1d 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -176,9 +176,9 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
176 if (space_left <= 0) 176 if (space_left <= 0)
177 { 177 {
178 ptrdiff_t in_buffer = p - get_doc_string_buffer; 178 ptrdiff_t in_buffer = p - get_doc_string_buffer;
179 get_doc_string_buffer = 179 get_doc_string_buffer
180 xpalloc (get_doc_string_buffer, &get_doc_string_buffer_size, 180 = xpalloc (get_doc_string_buffer, &get_doc_string_buffer_size,
181 16 * 1024, -1, 1); 181 16 * 1024, -1, 1);
182 p = get_doc_string_buffer + in_buffer; 182 p = get_doc_string_buffer + in_buffer;
183 space_left = (get_doc_string_buffer_size - 1 183 space_left = (get_doc_string_buffer_size - 1
184 - (p - get_doc_string_buffer)); 184 - (p - get_doc_string_buffer));
@@ -279,10 +279,10 @@ Invalid data in documentation file -- %c followed by code %03o",
279 else 279 else
280 { 280 {
281 /* The data determines whether the string is multibyte. */ 281 /* The data determines whether the string is multibyte. */
282 ptrdiff_t nchars = 282 ptrdiff_t nchars
283 multibyte_chars_in_text (((unsigned char *) get_doc_string_buffer 283 = multibyte_chars_in_text (((unsigned char *) get_doc_string_buffer
284 + offset), 284 + offset),
285 to - (get_doc_string_buffer + offset)); 285 to - (get_doc_string_buffer + offset));
286 return make_string_from_bytes (get_doc_string_buffer + offset, 286 return make_string_from_bytes (get_doc_string_buffer + offset,
287 nchars, 287 nchars,
288 to - (get_doc_string_buffer + offset)); 288 to - (get_doc_string_buffer + offset));
diff --git a/src/font.c b/src/font.c
index 3cffe2558ae..bed0ac8caf2 100644
--- a/src/font.c
+++ b/src/font.c
@@ -4603,7 +4603,7 @@ If the font is not OpenType font, CAPABILITY is nil. */)
4603 4603
4604 CHECK_FONT_GET_OBJECT (font_object, font); 4604 CHECK_FONT_GET_OBJECT (font_object, font);
4605 4605
4606 val = Fmake_vector (make_number (9), Qnil); 4606 val = make_uninit_vector (9);
4607 ASET (val, 0, AREF (font_object, FONT_NAME_INDEX)); 4607 ASET (val, 0, AREF (font_object, FONT_NAME_INDEX));
4608 ASET (val, 1, AREF (font_object, FONT_FILE_INDEX)); 4608 ASET (val, 1, AREF (font_object, FONT_FILE_INDEX));
4609 ASET (val, 2, make_number (font->pixel_size)); 4609 ASET (val, 2, make_number (font->pixel_size));
@@ -4614,6 +4614,8 @@ If the font is not OpenType font, CAPABILITY is nil. */)
4614 ASET (val, 7, make_number (font->average_width)); 4614 ASET (val, 7, make_number (font->average_width));
4615 if (font->driver->otf_capability) 4615 if (font->driver->otf_capability)
4616 ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font))); 4616 ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font)));
4617 else
4618 ASET (val, 8, Qnil);
4617 return val; 4619 return val;
4618} 4620}
4619 4621
@@ -4870,7 +4872,7 @@ If the named font is not yet loaded, return nil. */)
4870 return Qnil; 4872 return Qnil;
4871 font = XFONT_OBJECT (font_object); 4873 font = XFONT_OBJECT (font_object);
4872 4874
4873 info = Fmake_vector (make_number (7), Qnil); 4875 info = make_uninit_vector (7);
4874 ASET (info, 0, AREF (font_object, FONT_NAME_INDEX)); 4876 ASET (info, 0, AREF (font_object, FONT_NAME_INDEX));
4875 ASET (info, 1, AREF (font_object, FONT_FULLNAME_INDEX)); 4877 ASET (info, 1, AREF (font_object, FONT_FULLNAME_INDEX));
4876 ASET (info, 2, make_number (font->pixel_size)); 4878 ASET (info, 2, make_number (font->pixel_size));
@@ -5163,7 +5165,7 @@ See `font-weight-table' for the format of the vector. */);
5163 XSYMBOL (intern_c_string ("font-width-table"))->constant = 1; 5165 XSYMBOL (intern_c_string ("font-width-table"))->constant = 1;
5164 5166
5165 staticpro (&font_style_table); 5167 staticpro (&font_style_table);
5166 font_style_table = Fmake_vector (make_number (3), Qnil); 5168 font_style_table = make_uninit_vector (3);
5167 ASET (font_style_table, 0, Vfont_weight_table); 5169 ASET (font_style_table, 0, Vfont_weight_table);
5168 ASET (font_style_table, 1, Vfont_slant_table); 5170 ASET (font_style_table, 1, Vfont_slant_table);
5169 ASET (font_style_table, 2, Vfont_width_table); 5171 ASET (font_style_table, 2, Vfont_width_table);
diff --git a/src/fontset.c b/src/fontset.c
index b7f3e46d69c..3578bc9403d 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -271,7 +271,8 @@ set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback)
271/* Macros for FONT-DEF and RFONT-DEF of fontset. */ 271/* Macros for FONT-DEF and RFONT-DEF of fontset. */
272#define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \ 272#define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \
273 do { \ 273 do { \
274 (font_def) = Fmake_vector (make_number (3), (font_spec)); \ 274 (font_def) = make_uninit_vector (3); \
275 ASET ((font_def), 0, font_spec); \
275 ASET ((font_def), 1, encoding); \ 276 ASET ((font_def), 1, encoding); \
276 ASET ((font_def), 2, repertory); \ 277 ASET ((font_def), 2, repertory); \
277 } while (0) 278 } while (0)
@@ -1591,7 +1592,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1591 { 1592 {
1592 Lisp_Object arg; 1593 Lisp_Object arg;
1593 1594
1594 arg = Fmake_vector (make_number (5), Qnil); 1595 arg = make_uninit_vector (5);
1595 ASET (arg, 0, fontset); 1596 ASET (arg, 0, fontset);
1596 ASET (arg, 1, font_def); 1597 ASET (arg, 1, font_def);
1597 ASET (arg, 2, add); 1598 ASET (arg, 2, add);
diff --git a/src/ftfont.c b/src/ftfont.c
index 03e40bf2e46..1fb1b574a1c 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -2555,9 +2555,8 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
2555 LGLYPH_SET_DESCENT (lglyph, g->descent >> 6); 2555 LGLYPH_SET_DESCENT (lglyph, g->descent >> 6);
2556 if (g->adjusted) 2556 if (g->adjusted)
2557 { 2557 {
2558 Lisp_Object vec; 2558 Lisp_Object vec = make_uninit_vector (3);
2559 2559
2560 vec = Fmake_vector (make_number (3), Qnil);
2561 ASET (vec, 0, make_number (g->xoff >> 6)); 2560 ASET (vec, 0, make_number (g->xoff >> 6));
2562 ASET (vec, 1, make_number (g->yoff >> 6)); 2561 ASET (vec, 1, make_number (g->yoff >> 6));
2563 ASET (vec, 2, make_number (g->xadv >> 6)); 2562 ASET (vec, 2, make_number (g->xadv >> 6));
diff --git a/src/indent.c b/src/indent.c
index 45b6afbd395..44ecbbc8a58 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -138,7 +138,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
138 struct Lisp_Vector *widthtab; 138 struct Lisp_Vector *widthtab;
139 139
140 if (!VECTORP (BVAR (buf, width_table))) 140 if (!VECTORP (BVAR (buf, width_table)))
141 bset_width_table (buf, Fmake_vector (make_number (256), make_number (0))); 141 bset_width_table (buf, make_uninit_vector (256));
142 widthtab = XVECTOR (BVAR (buf, width_table)); 142 widthtab = XVECTOR (BVAR (buf, width_table));
143 eassert (widthtab->header.size == 256); 143 eassert (widthtab->header.size == 256);
144 144
diff --git a/src/lisp.h b/src/lisp.h
index dd8d1f38db6..787457b4872 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3048,6 +3048,27 @@ extern void make_byte_code (struct Lisp_Vector *);
3048extern Lisp_Object Qautomatic_gc; 3048extern Lisp_Object Qautomatic_gc;
3049extern Lisp_Object Qchar_table_extra_slots; 3049extern Lisp_Object Qchar_table_extra_slots;
3050extern struct Lisp_Vector *allocate_vector (EMACS_INT); 3050extern struct Lisp_Vector *allocate_vector (EMACS_INT);
3051
3052/* Make an unitialized vector for SIZE objects. NOTE: you must
3053 be sure that GC cannot happen until the vector is completely
3054 initialized. E.g. the following code is likely to crash:
3055
3056 v = make_uninit_vector (3);
3057 ASET (v, 0, obj0);
3058 ASET (v, 1, Ffunction_can_gc ());
3059 ASET (v, 2, obj1); */
3060
3061LISP_INLINE Lisp_Object
3062make_uninit_vector (ptrdiff_t size)
3063{
3064 Lisp_Object v;
3065 struct Lisp_Vector *p;
3066
3067 p = allocate_vector (size);
3068 XSETVECTOR (v, p);
3069 return v;
3070}
3071
3051extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type); 3072extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type);
3052#define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ 3073#define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \
3053 ((typ*) \ 3074 ((typ*) \
diff --git a/src/lread.c b/src/lread.c
index 09eccb0fb30..c62c62a5e5a 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -96,11 +96,6 @@ static Lisp_Object Qload_in_progress;
96 It must be set to nil before all top-level calls to read0. */ 96 It must be set to nil before all top-level calls to read0. */
97static Lisp_Object read_objects; 97static Lisp_Object read_objects;
98 98
99/* True means READCHAR should read bytes one by one (not character)
100 when READCHARFUN is Qget_file_char or Qget_emacs_mule_file_char.
101 This is set by read1 temporarily while handling #@NUMBER. */
102static bool load_each_byte;
103
104/* List of descriptors now open for Fload. */ 99/* List of descriptors now open for Fload. */
105static Lisp_Object load_descriptor_list; 100static Lisp_Object load_descriptor_list;
106 101
@@ -328,7 +323,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
328 return c; 323 return c;
329 } 324 }
330 c = (*readbyte) (-1, readcharfun); 325 c = (*readbyte) (-1, readcharfun);
331 if (c < 0 || load_each_byte) 326 if (c < 0)
332 return c; 327 return c;
333 if (multibyte) 328 if (multibyte)
334 *multibyte = 1; 329 *multibyte = 1;
@@ -353,6 +348,30 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
353 return STRING_CHAR (buf); 348 return STRING_CHAR (buf);
354} 349}
355 350
351static void
352skip_dyn_bytes (Lisp_Object readcharfun, ptrdiff_t n)
353{
354 if (EQ (readcharfun, Qget_file_char)
355 || EQ (readcharfun, Qget_emacs_mule_file_char))
356 {
357 block_input (); /* FIXME: Not sure if it's needed. */
358 fseek (instream, n, SEEK_CUR);
359 unblock_input ();
360 }
361 else
362 { /* We're not reading directly from a file. In that case, it's difficult
363 to reliably count bytes, since these are usually meant for the file's
364 encoding, whereas we're now typically in the internal encoding.
365 But luckily, skip_dyn_bytes is used to skip over a single
366 dynamic-docstring (or dynamic byte-code) which is always quoted such
367 that \037 is the final char. */
368 int c;
369 do {
370 c = READCHAR;
371 } while (c >= 0 && c != '\037');
372 }
373}
374
356/* Unread the character C in the way appropriate for the stream READCHARFUN. 375/* Unread the character C in the way appropriate for the stream READCHARFUN.
357 If the stream is a user function, call it with the char as argument. */ 376 If the stream is a user function, call it with the char as argument. */
358 377
@@ -407,14 +426,7 @@ unreadchar (Lisp_Object readcharfun, int c)
407 else if (EQ (readcharfun, Qget_file_char) 426 else if (EQ (readcharfun, Qget_file_char)
408 || EQ (readcharfun, Qget_emacs_mule_file_char)) 427 || EQ (readcharfun, Qget_emacs_mule_file_char))
409 { 428 {
410 if (load_each_byte) 429 unread_char = c;
411 {
412 block_input ();
413 ungetc (c, instream);
414 unblock_input ();
415 }
416 else
417 unread_char = c;
418 } 430 }
419 else 431 else
420 call1 (readcharfun, make_number (c)); 432 call1 (readcharfun, make_number (c));
@@ -2388,7 +2400,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2388 bool multibyte; 2400 bool multibyte;
2389 2401
2390 *pch = 0; 2402 *pch = 0;
2391 load_each_byte = 0;
2392 2403
2393 retry: 2404 retry:
2394 2405
@@ -2598,7 +2609,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2598 return tmp; 2609 return tmp;
2599 } 2610 }
2600 2611
2601 /* #@NUMBER is used to skip NUMBER following characters. 2612 /* #@NUMBER is used to skip NUMBER following bytes.
2602 That's used in .elc files to skip over doc strings 2613 That's used in .elc files to skip over doc strings
2603 and function definitions. */ 2614 and function definitions. */
2604 if (c == '@') 2615 if (c == '@')
@@ -2606,7 +2617,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2606 enum { extra = 100 }; 2617 enum { extra = 100 };
2607 ptrdiff_t i, nskip = 0; 2618 ptrdiff_t i, nskip = 0;
2608 2619
2609 load_each_byte = 1;
2610 /* Read a decimal integer. */ 2620 /* Read a decimal integer. */
2611 while ((c = READCHAR) >= 0 2621 while ((c = READCHAR) >= 0
2612 && c >= '0' && c <= '9') 2622 && c >= '0' && c <= '9')
@@ -2616,8 +2626,15 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2616 nskip *= 10; 2626 nskip *= 10;
2617 nskip += c - '0'; 2627 nskip += c - '0';
2618 } 2628 }
2619 UNREAD (c); 2629 if (nskip > 0)
2620 2630 /* We can't use UNREAD here, because in the code below we side-step
2631 READCHAR. Instead, assume the first char after #@NNN occupies
2632 a single byte, which is the case normally since it's just
2633 a space. */
2634 nskip--;
2635 else
2636 UNREAD (c);
2637
2621 if (load_force_doc_strings 2638 if (load_force_doc_strings
2622 && (EQ (readcharfun, Qget_file_char) 2639 && (EQ (readcharfun, Qget_file_char)
2623 || EQ (readcharfun, Qget_emacs_mule_file_char))) 2640 || EQ (readcharfun, Qget_emacs_mule_file_char)))
@@ -2659,19 +2676,17 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2659 saved_doc_string_position = file_tell (instream); 2676 saved_doc_string_position = file_tell (instream);
2660 2677
2661 /* Copy that many characters into saved_doc_string. */ 2678 /* Copy that many characters into saved_doc_string. */
2679 block_input ();
2662 for (i = 0; i < nskip && c >= 0; i++) 2680 for (i = 0; i < nskip && c >= 0; i++)
2663 saved_doc_string[i] = c = READCHAR; 2681 saved_doc_string[i] = c = getc (instream);
2682 unblock_input ();
2664 2683
2665 saved_doc_string_length = i; 2684 saved_doc_string_length = i;
2666 } 2685 }
2667 else 2686 else
2668 { 2687 /* Skip that many bytes. */
2669 /* Skip that many characters. */ 2688 skip_dyn_bytes (readcharfun, nskip);
2670 for (i = 0; i < nskip && c >= 0; i++)
2671 c = READCHAR;
2672 }
2673 2689
2674 load_each_byte = 0;
2675 goto retry; 2690 goto retry;
2676 } 2691 }
2677 if (c == '!') 2692 if (c == '!')
diff --git a/src/nsselect.m b/src/nsselect.m
index 903448ce0a5..49380f87945 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -117,7 +117,7 @@ clean_local_selection_data (Lisp_Object obj)
117 117
118 if (size == 1) 118 if (size == 1)
119 return clean_local_selection_data (AREF (obj, 0)); 119 return clean_local_selection_data (AREF (obj, 0));
120 copy = Fmake_vector (make_number (size), Qnil); 120 copy = make_uninit_vector (size);
121 for (i = 0; i < size; i++) 121 for (i = 0; i < size; i++)
122 ASET (copy, i, clean_local_selection_data (AREF (obj, i))); 122 ASET (copy, i, clean_local_selection_data (AREF (obj, i)));
123 return copy; 123 return copy;
diff --git a/src/search.c b/src/search.c
index 545f614a063..c4ccf6c257b 100644
--- a/src/search.c
+++ b/src/search.c
@@ -644,18 +644,23 @@ scan_buffer (int target, ptrdiff_t start, ptrdiff_t end,
644 ptrdiff_t count, ptrdiff_t *shortage, bool allow_quit) 644 ptrdiff_t count, ptrdiff_t *shortage, bool allow_quit)
645{ 645{
646 struct region_cache *newline_cache; 646 struct region_cache *newline_cache;
647 ptrdiff_t end_byte = -1;
647 int direction; 648 int direction;
648 649
649 if (count > 0) 650 if (count > 0)
650 { 651 {
651 direction = 1; 652 direction = 1;
652 if (! end) end = ZV; 653 if (!end)
654 end = ZV, end_byte = ZV_BYTE;
653 } 655 }
654 else 656 else
655 { 657 {
656 direction = -1; 658 direction = -1;
657 if (! end) end = BEGV; 659 if (!end)
660 end = BEGV, end_byte = BEGV_BYTE;
658 } 661 }
662 if (end_byte == -1)
663 end_byte = CHAR_TO_BYTE (end);
659 664
660 newline_cache_on_off (current_buffer); 665 newline_cache_on_off (current_buffer);
661 newline_cache = current_buffer->newline_cache; 666 newline_cache = current_buffer->newline_cache;
@@ -673,7 +678,7 @@ scan_buffer (int target, ptrdiff_t start, ptrdiff_t end,
673 the position of the last character before the next such 678 the position of the last character before the next such
674 obstacle --- the last character the dumb search loop should 679 obstacle --- the last character the dumb search loop should
675 examine. */ 680 examine. */
676 ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end) - 1; 681 ptrdiff_t ceiling_byte = end_byte - 1;
677 ptrdiff_t start_byte; 682 ptrdiff_t start_byte;
678 ptrdiff_t tem; 683 ptrdiff_t tem;
679 684
@@ -750,7 +755,7 @@ scan_buffer (int target, ptrdiff_t start, ptrdiff_t end,
750 while (start > end) 755 while (start > end)
751 { 756 {
752 /* The last character to check before the next obstacle. */ 757 /* The last character to check before the next obstacle. */
753 ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end); 758 ptrdiff_t ceiling_byte = end_byte;
754 ptrdiff_t start_byte; 759 ptrdiff_t start_byte;
755 ptrdiff_t tem; 760 ptrdiff_t tem;
756 761
@@ -861,8 +866,6 @@ scan_newline (ptrdiff_t start, ptrdiff_t start_byte,
861 if (allow_quit) 866 if (allow_quit)
862 immediate_quit++; 867 immediate_quit++;
863 868
864 start_byte = CHAR_TO_BYTE (start);
865
866 if (count > 0) 869 if (count > 0)
867 { 870 {
868 while (start_byte < limit_byte) 871 while (start_byte < limit_byte)
@@ -1016,8 +1019,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
1016 1019
1017 if (!EQ (noerror, Qt)) 1020 if (!EQ (noerror, Qt))
1018 { 1021 {
1019 if (lim < BEGV || lim > ZV) 1022 eassert (BEGV <= lim && lim <= ZV);
1020 emacs_abort ();
1021 SET_PT_BOTH (lim, lim_byte); 1023 SET_PT_BOTH (lim, lim_byte);
1022 return Qnil; 1024 return Qnil;
1023#if 0 /* This would be clean, but maybe programs depend on 1025#if 0 /* This would be clean, but maybe programs depend on
@@ -1029,9 +1031,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
1029 return Qnil; 1031 return Qnil;
1030 } 1032 }
1031 1033
1032 if (np < BEGV || np > ZV) 1034 eassert (BEGV <= np && np <= ZV);
1033 emacs_abort ();
1034
1035 SET_PT (np); 1035 SET_PT (np);
1036 1036
1037 return make_number (np); 1037 return make_number (np);
diff --git a/src/syntax.c b/src/syntax.c
index 72d904914ec..42500b0cb76 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -121,6 +121,7 @@ struct lisp_parse_state
121 /* Char number of start of containing expression */ 121 /* Char number of start of containing expression */
122 ptrdiff_t prevlevelstart; 122 ptrdiff_t prevlevelstart;
123 ptrdiff_t location; /* Char number at which parsing stopped. */ 123 ptrdiff_t location; /* Char number at which parsing stopped. */
124 ptrdiff_t location_byte; /* Corresponding byte position. */
124 ptrdiff_t comstr_start; /* Position of last comment/string starter. */ 125 ptrdiff_t comstr_start; /* Position of last comment/string starter. */
125 Lisp_Object levelstarts; /* Char numbers of starts-of-expression 126 Lisp_Object levelstarts; /* Char numbers of starts-of-expression
126 of levels (starting from outermost). */ 127 of levels (starting from outermost). */
@@ -3288,6 +3289,7 @@ do { prev_from = from; \
3288 state.prevlevelstart 3289 state.prevlevelstart
3289 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last; 3290 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last;
3290 state.location = from; 3291 state.location = from;
3292 state.location_byte = from_byte;
3291 state.levelstarts = Qnil; 3293 state.levelstarts = Qnil;
3292 while (curlevel > levelstart) 3294 while (curlevel > levelstart)
3293 state.levelstarts = Fcons (make_number ((--curlevel)->last), 3295 state.levelstarts = Fcons (make_number ((--curlevel)->last),
@@ -3327,7 +3329,8 @@ Fifth arg OLDSTATE is a list like what this function returns.
3327Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. 3329Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
3328 If it is symbol `syntax-table', stop after the start of a comment or a 3330 If it is symbol `syntax-table', stop after the start of a comment or a
3329 string, or after end of a comment or a string. */) 3331 string, or after end of a comment or a string. */)
3330 (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) 3332 (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth,
3333 Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop)
3331{ 3334{
3332 struct lisp_parse_state state; 3335 struct lisp_parse_state state;
3333 EMACS_INT target; 3336 EMACS_INT target;
@@ -3347,7 +3350,7 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
3347 (NILP (commentstop) 3350 (NILP (commentstop)
3348 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1))); 3351 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1)));
3349 3352
3350 SET_PT (state.location); 3353 SET_PT_BOTH (state.location, state.location_byte);
3351 3354
3352 return Fcons (make_number (state.depth), 3355 return Fcons (make_number (state.depth),
3353 Fcons (state.prevlevelstart < 0 3356 Fcons (state.prevlevelstart < 0
@@ -3389,8 +3392,8 @@ init_syntax_once (void)
3389 Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots"); 3392 Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots");
3390 3393
3391 /* Create objects which can be shared among syntax tables. */ 3394 /* Create objects which can be shared among syntax tables. */
3392 Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil); 3395 Vsyntax_code_object = make_uninit_vector (Smax);
3393 for (i = 0; i < ASIZE (Vsyntax_code_object); i++) 3396 for (i = 0; i < Smax; i++)
3394 ASET (Vsyntax_code_object, i, Fcons (make_number (i), Qnil)); 3397 ASET (Vsyntax_code_object, i, Fcons (make_number (i), Qnil));
3395 3398
3396 /* Now we are ready to set up this property, so we can 3399 /* Now we are ready to set up this property, so we can
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 88227487d35..56931adfac5 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -435,8 +435,8 @@ uniscribe_shape (Lisp_Object lgstring)
435 are zero. */ 435 are zero. */
436 || (!attributes[j].fClusterStart && items[i].a.fRTL)) 436 || (!attributes[j].fClusterStart && items[i].a.fRTL))
437 { 437 {
438 Lisp_Object vec; 438 Lisp_Object vec = make_uninit_vector (3);
439 vec = Fmake_vector (make_number (3), Qnil); 439
440 if (items[i].a.fRTL) 440 if (items[i].a.fRTL)
441 { 441 {
442 /* Empirically, it looks like Uniscribe 442 /* Empirically, it looks like Uniscribe
diff --git a/src/window.c b/src/window.c
index b9165e21d3b..68dcf28f52f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6194,11 +6194,11 @@ saved by this function. */)
6194 data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil; 6194 data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil;
6195 data->root_window = FRAME_ROOT_WINDOW (f); 6195 data->root_window = FRAME_ROOT_WINDOW (f);
6196 data->focus_frame = FRAME_FOCUS_FRAME (f); 6196 data->focus_frame = FRAME_FOCUS_FRAME (f);
6197 tem = Fmake_vector (make_number (n_windows), Qnil); 6197 tem = make_uninit_vector (n_windows);
6198 data->saved_windows = tem; 6198 data->saved_windows = tem;
6199 for (i = 0; i < n_windows; i++) 6199 for (i = 0; i < n_windows; i++)
6200 ASET (tem, i, 6200 ASET (tem, i,
6201 Fmake_vector (make_number (VECSIZE (struct saved_window)), Qnil)); 6201 Fmake_vector (make_number (VECSIZE (struct saved_window)), Qnil));
6202 save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0); 6202 save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
6203 XSETWINDOW_CONFIGURATION (tem, data); 6203 XSETWINDOW_CONFIGURATION (tem, data);
6204 return (tem); 6204 return (tem);
diff --git a/src/xdisp.c b/src/xdisp.c
index fe6aa8ad8c3..8a96a3eadc7 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21682,11 +21682,15 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21682} 21682}
21683 21683
21684 21684
21685/* Count up to COUNT lines starting from START_BYTE. 21685/* Count up to COUNT lines starting from START_BYTE. COUNT negative
21686 But don't go beyond LIMIT_BYTE. 21686 means count lines back from START_BYTE. But don't go beyond
21687 Return the number of lines thus found (always nonnegative). 21687 LIMIT_BYTE. Return the number of lines thus found (always
21688 21688 nonnegative).
21689 Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT. */ 21689
21690 Set *BYTE_POS_PTR to the byte position where we stopped. This is
21691 either the position COUNT lines after/before START_BYTE, if we
21692 found COUNT lines, or LIMIT_BYTE if we hit the limit before finding
21693 COUNT lines. */
21690 21694
21691static ptrdiff_t 21695static ptrdiff_t
21692display_count_lines (ptrdiff_t start_byte, 21696display_count_lines (ptrdiff_t start_byte,
diff --git a/src/xfaces.c b/src/xfaces.c
index 43535b9ea0c..33a221fdd52 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1585,7 +1585,7 @@ the face font sort order. */)
1585 for (i = nfonts - 1; i >= 0; --i) 1585 for (i = nfonts - 1; i >= 0; --i)
1586 { 1586 {
1587 Lisp_Object font = AREF (vec, i); 1587 Lisp_Object font = AREF (vec, i);
1588 Lisp_Object v = Fmake_vector (make_number (8), Qnil); 1588 Lisp_Object v = make_uninit_vector (8);
1589 int point; 1589 int point;
1590 Lisp_Object spacing; 1590 Lisp_Object spacing;
1591 1591
diff --git a/src/xselect.c b/src/xselect.c
index d769f86cdef..decea696bfd 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1670,8 +1670,8 @@ selection_data_to_lisp_data (Display *display, const unsigned char *data,
1670 return x_atom_to_symbol (display, (Atom) idata[0]); 1670 return x_atom_to_symbol (display, (Atom) idata[0]);
1671 else 1671 else
1672 { 1672 {
1673 Lisp_Object v = Fmake_vector (make_number (size / sizeof (int)), 1673 Lisp_Object v = make_uninit_vector (size / sizeof (int));
1674 make_number (0)); 1674
1675 for (i = 0; i < size / sizeof (int); i++) 1675 for (i = 0; i < size / sizeof (int); i++)
1676 ASET (v, i, x_atom_to_symbol (display, (Atom) idata[i])); 1676 ASET (v, i, x_atom_to_symbol (display, (Atom) idata[i]));
1677 return v; 1677 return v;
@@ -1693,8 +1693,8 @@ selection_data_to_lisp_data (Display *display, const unsigned char *data,
1693 else if (format == 16) 1693 else if (format == 16)
1694 { 1694 {
1695 ptrdiff_t i; 1695 ptrdiff_t i;
1696 Lisp_Object v; 1696 Lisp_Object v = make_uninit_vector (size / 2);
1697 v = Fmake_vector (make_number (size / 2), make_number (0)); 1697
1698 for (i = 0; i < size / 2; i++) 1698 for (i = 0; i < size / 2; i++)
1699 { 1699 {
1700 short j = ((short *) data) [i]; 1700 short j = ((short *) data) [i];
@@ -1705,8 +1705,8 @@ selection_data_to_lisp_data (Display *display, const unsigned char *data,
1705 else 1705 else
1706 { 1706 {
1707 ptrdiff_t i; 1707 ptrdiff_t i;
1708 Lisp_Object v = Fmake_vector (make_number (size / X_LONG_SIZE), 1708 Lisp_Object v = make_uninit_vector (size / X_LONG_SIZE);
1709 make_number (0)); 1709
1710 for (i = 0; i < size / X_LONG_SIZE; i++) 1710 for (i = 0; i < size / X_LONG_SIZE; i++)
1711 { 1711 {
1712 int j = ((int *) data) [i]; 1712 int j = ((int *) data) [i];