1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-07-27 17:14:58 +08:00
commit 24711be050
20 changed files with 701 additions and 364 deletions

View File

@ -2474,12 +2474,15 @@ if test "${with_sound}" != "no"; then
AC_MSG_ERROR([OSS sound support requested but not found.])
if test "${with_sound}" = "bsd-ossaudio" || test "${with_sound}" = "yes"; then
# Emulation library used on NetBSD.
# OSS emulation library used on NetBSD and OpenBSD.
AC_CHECK_LIB([ossaudio], [_oss_ioctl], [LIBSOUND=-lossaudio], [LIBSOUND=])
test "${with_sound}" = "bsd-ossaudio" && test -z "$LIBSOUND" && \
AC_MSG_ERROR([bsd-ossaudio sound support requested but not found.])
dnl FIXME? If we did find ossaudio, should we set with_sound=bsd-ossaudio?
dnl Traditionally, we go on to check for alsa too. Does that make sense?
# On {Net,Open}BSD use the system audio library instead of
# potentially switching to ALSA below, as ALSA on these appears to
# just wrap system libraries.
test "${with_sound}" = "yes" && test "$LIBSOUND" = "-lossaudio" && \
with_sound="bsd-ossaudio"
fi
AC_SUBST([LIBSOUND])

View File

@ -2823,7 +2823,12 @@ library. @xref{Hooks}.
@subsection How Emacs Finds Your Init File
Emacs normally finds your init file in a location under your home
directory. @xref{Init File}.
directory@footnote{
On MS-Windows, there's no single directory considered by all programs
as ``the home directory'' of the user. Emacs uses one of the
pertinent directories as the equivalent of your home directory; see
@ref{Windows HOME}, for the details.
}. @xref{Init File}.
Emacs looks for your init file using the filenames @file{~/.emacs.el},
@file{~/.emacs}, or @file{~/.emacs.d/init.el} in that order; you can

View File

@ -189,9 +189,13 @@ selected frame.
@end defvar
@defopt server-after-make-frame-hook
A normal hook run when the Emacs server creates a client frame. When
this hook is called, the created frame is the selected one.
@xref{Emacs Server,,, emacs, The GNU Emacs Manual}.
A normal hook run when the Emacs server starts using a client frame.
When this hook is called, the client frame is the selected one. Note
that, depending on how @command{emacsclient} was invoked
(@pxref{Invoking emacsclient,,, emacs, The GNU Emacs Manual}), this
client frame could be a new frame created for the client, or it could
be an existing frame that the server reused for handling the client
commands. @xref{Emacs Server,,, emacs, The GNU Emacs Manual}.
@end defopt

View File

@ -30,6 +30,16 @@ NDK, SDK, and a suitable Java compiler must also be installed.
See the file 'java/INSTALL' for more details.
---
** Emacs now defaults to ossaudio library for sound on NetBSD and OpenBSD.
Previously configure used ALSA libraries if installed on the
system when configured '--with-sound=yes' (which is the default), with
fallback to libossaudio. The libossaudio library included with the
base system is now used even if ALSA is found to avoid relying on
external packages and to resolve potential incompatibilities between
Linux and BSD versions of ALSA. Use '--with-sound=alsa' to build with
ALSA on these operating systems instead.
* Startup Changes in Emacs 30.1
@ -109,6 +119,15 @@ window systems other than Nextstep.
When this minor mode is enabled, buttons representing modifier keys
are displayed along the tool bar.
---
** New user option 'uniquify-dirname-transform'.
This can be used to customize how buffer names are uniquified, by
making arbitrary transforms on the buffer's directory name (whose
components are used to uniquify buffer names when they clash). You
can use this to distinguish between buffers visiting files with the
same base name that belong to different projects by using the provided
transform function 'project-uniquify-dirname-transform'.
** cl-print
*** You can expand the "..." truncation everywhere.

View File

@ -973,7 +973,7 @@ for speeding up processing.")
(let ((nargs (length (cdr form))))
(cond
((= nargs 1)
`(progn (cadr form) t))
`(progn ,(cadr form) t))
((>= nargs 3)
;; At least 3 arguments: transform to N-1 binary comparisons,
;; since those have their own byte-ops which are particularly
@ -1924,7 +1924,7 @@ See Info node `(elisp) Integer Basics'."
(let ((pure-fns
'(
;; character.c
characterp
characterp max-char
;; data.c
% * + - / /= 1+ 1- < <= = > >= aref arrayp ash atom bare-symbol
bool-vector-count-consecutive bool-vector-count-population

View File

@ -134,7 +134,7 @@
(purecopy (concat "^\\s-*("
(regexp-opt
'(;; Elisp
"defconst" "defcustom"
"defconst" "defcustom" "defvar-keymap"
;; CL
"defconstant"
"defparameter" "define-symbol-macro")
@ -361,7 +361,7 @@ This will generate compile-time constants from BINDINGS."
"define-globalized-minor-mode" "define-skeleton"
"define-widget" "ert-deftest"))
(el-vdefs '("defconst" "defcustom" "defvaralias" "defvar-local"
"defface"))
"defface" "define-error"))
(el-tdefs '("defgroup" "deftheme"))
(el-errs '("user-error"))
;; Common-Lisp constructs supported by EIEIO. FIXME: namespace.

View File

@ -315,7 +315,7 @@ If this is nil, `man' will use `locale-coding-system'."
:type 'hook
:group 'man)
(defvar Man-name-regexp "[-[:alnum:]_­+][-[:alnum:]_.:­+]*"
(defvar Man-name-regexp "[-[:alnum:]_­+[@][-[:alnum:]_.:­+]*"
"Regular expression describing the name of a manpage (without section).")
(defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]"
@ -937,7 +937,16 @@ foo(sec)[, bar(sec) [, ...]] [other stuff] - description"
"-k" (concat (when (or Man-man-k-use-anchor
(string-equal prefix ""))
"^")
prefix))))
(if (string-equal prefix "")
prefix
;; FIXME: shell-quote-argument
;; is not entirely
;; appropriate: we actually
;; need to quote ERE here.
;; But we don't have that, and
;; shell-quote-argument does
;; the job...
(shell-quote-argument prefix))))))
(setq table (Man-parse-man-k)))))
;; Cache the table for later reuse.
(when table

View File

@ -4867,12 +4867,17 @@ Goes through the list `tramp-inline-compress-commands'."
" -o ControlPath="
(if (eq tramp-use-connection-share 'suppress)
"none"
;; Hashed tokens are introduced in OpenSSH 6.7.
(expand-file-name
(if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
"tramp.%%C" "tramp.%%r@%%h:%%p")
(or small-temporary-file-directory
tramp-compat-temporary-file-directory)))
;; Hashed tokens are introduced in OpenSSH 6.7. On macOS
;; we cannot use an absolute file name, it is too long.
;; See Bug#19702.
(if (eq system-type 'darwin)
(if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
"tramp.%%C" "tramp.%%r@%%h:%%p")
(expand-file-name
(if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
"tramp.%%C" "tramp.%%r@%%h:%%p")
(or small-temporary-file-directory
tramp-compat-temporary-file-directory))))
;; ControlPersist option is introduced in OpenSSH 5.6.
(when (and (not (eq tramp-use-connection-share 'suppress))

View File

@ -7361,6 +7361,9 @@ One may build such TAGS files from CPerl mode menu."
(nreverse list2))
list1)))))
(defvar imenu-max-items nil
"Max items in an imenu list. Defined in imenu.el.")
(defun cperl-menu-to-keymap (menu)
(let (list)
(cons 'keymap
@ -7750,10 +7753,27 @@ $~ The name of the current report format.
... >> ... Bitwise shift right.
... >>= ... Bitwise shift right assignment.
... ? ... : ... Condition=if-then-else operator.
... | ... Bitwise or.
... || ... Logical or.
... // ... Defined-or.
~ ... Unary bitwise complement.
... and ... Low-precedence synonym for &&.
... cmp ... String compare.
... eq ... String equality.
... ge ... String greater than or equal.
... gt ... String greater than.
... le ... String less than or equal.
... lt ... String less than.
... ne ... String inequality.
not ... Low-precedence synonym for ! - negation.
... or ... Low-precedence synonym for ||.
... x ... Repeat string or array.
x= ... Repetition assignment.
... xor ... Low-precedence synonym for exclusive or.
@ARGV Command line arguments (not including the command name - see $0).
@INC List of places to look for perl scripts during do/include/use.
@_ Parameter array for subroutines; result of split() unless in list context.
\\ Creates reference to what follows, like \\$var, or quotes non-\\w in strings.
\\ Creates reference to what follows, like \\$var. Quotes non-\\w in strings.
\\0 Octal char, e.g. \\033.
\\E Case modification terminator. See \\Q, \\L, and \\U.
\\L Lowercase until \\E . See also \\l, lc.
@ -7771,12 +7791,8 @@ $~ The name of the current report format.
\\u Upcase the next character. See also \\U and \\l, ucfirst.
\\x Hex character, e.g. \\x1b.
... ^ ... Bitwise exclusive or.
__END__ Ends program source.
__DATA__ Ends program source.
__FILE__ Current (source) filename.
__LINE__ Current line in current source.
__PACKAGE__ Current package.
__SUB__ Current sub.
__END__ Ends program source.
ADJUST {...} Callback for object creation
ARGV Default multi-file input filehandle. <ARGV> is a synonym for <>.
ARGVOUT Output filehandle with -i flag.
@ -7786,267 +7802,252 @@ CHECK { ... } Pseudo-subroutine executed after the script is compiled.
UNITCHECK { ... }
INIT { ... } Pseudo-subroutine executed before the script starts running.
DATA Input filehandle for what follows after __END__ or __DATA__.
accept(NEWSOCKET,GENERICSOCKET)
alarm(SECONDS)
abs [ EXPR ] absolute value function
accept(NEWSOCKET,GENERICSOCKET) accept an incoming socket connect
alarm(SECONDS) schedule a SIGALRM
async(SUB NAME {}|SUB {}) Mark function as potentially asynchronous
atan2(X,Y)
atan2(X,Y) arctangent of Y/X in the range -PI to PI
await(ASYNCEXPR) Yield result of Future
bind(SOCKET,NAME)
binmode(FILEHANDLE)
bind(SOCKET,NAME) binds an address to a socket
binmode(FILEHANDLE) prepare binary files for I/O
bless REFERENCE [, PACKAGE] Makes reference into an object of a package.
break Break out of a given/when statement
caller[(LEVEL)]
chdir(EXPR)
chmod(LIST)
chop[(LIST|VAR)]
chown(LIST)
chroot(FILENAME)
class NAME Introduce a class.
close(FILEHANDLE)
closedir(DIRHANDLE)
... cmp ... String compare.
connect(SOCKET,NAME)
caller[(LEVEL)] get context of the current subroutine call
chdir(EXPR) change your current working directory
chmod(LIST) changes the permissions on a list of files
chomp [LIST] Strips $/ off LIST/$_. Returns count.
chop[(LIST|VAR)] remove the last character from a string
chown(LIST) change the ownership on a list of files
chr [NUMBER] Converts a number to char with the same ordinal.
chroot(FILENAME) make directory new root for path lookups
class NAME Introduce an object class.
close(FILEHANDLE) close file (or pipe or socket) handle
closedir(DIRHANDLE) close directory handle
connect(SOCKET,NAME) connect to a remote socket
continue of { block } continue { block }. Is executed after `next' or at end.
cos(EXPR)
crypt(PLAINTEXT,SALT)
dbmclose(%HASH)
dbmopen(%HASH,DBNAME,MODE)
default { ... } default case for given/when block
defer { ... } run this block after the containing block.
defined(EXPR)
delete($HASH{KEY})
die(LIST)
cos(EXPR) cosine function
crypt(PLAINTEXT,SALT) one-way passwd-style encryption
dbmclose(%HASH) breaks binding on a tied dbm file
dbmopen(%HASH,DBNAME,MODE) create binding on a tied dbm file
defined(EXPR) test whether a value, variable, or function is defined
delete($HASH{KEY}) deletes a value from a hash
die(LIST) raise an exception or bail out
do { ... }|SUBR while|until EXPR executes at least once
do(EXPR|SUBR([LIST])) (with while|until executes at least once)
dump LABEL
each(%HASH)
endgrent
endhostent
endnetent
endprotoent
endpwent
endservent
eof[([FILEHANDLE])]
... eq ... String equality.
eval(EXPR) or eval { BLOCK }
dump LABEL create an immediate core dump
each(%HASH) retrieve the next key/value pair from a hash
endgrent be done using group file
endhostent be done using hosts file
endnetent be done using networks file
endprotoent be done using protocols file
endpwent be done using passwd file
endservent be done using services file
eof[([FILEHANDLE])] test a filehandle for its end
eval(EXPR) or eval { BLOCK } catch exceptions or compile and run code
evalbytes See eval.
exec([TRUENAME] ARGV0, ARGVs) or exec(SHELL_COMMAND_LINE)
exit(EXPR)
exp(EXPR)
exists $HASH{KEY} True if the key exists.
exit(EXPR) terminate this program
exp(EXPR) raise e to a power
fc EXPR Returns the casefolded version of EXPR.
fcntl(FILEHANDLE,FUNCTION,SCALAR)
field VAR [:param[(NAME)]] [=EXPR] declare an object attribute
fileno(FILEHANDLE)
flock(FILEHANDLE,OPERATION)
for (EXPR;EXPR;EXPR) { ... }
foreach [VAR] (@ARRAY) { ... }
fork
... ge ... String greater than or equal.
getc[(FILEHANDLE)]
getgrent
getgrgid(GID)
getgrnam(NAME)
gethostbyaddr(ADDR,ADDRTYPE)
gethostbyname(NAME)
gethostent
getlogin
getnetbyaddr(ADDR,ADDRTYPE)
getnetbyname(NAME)
getnetent
getpeername(SOCKET)
getpgrp(PID)
getppid
getpriority(WHICH,WHO)
getprotobyname(NAME)
getprotobynumber(NUMBER)
getprotoent
getpwent
getpwnam(NAME)
getpwuid(UID)
getservbyname(NAME,PROTO)
getservbyport(PORT,PROTO)
getservent
getsockname(SOCKET)
getsockopt(SOCKET,LEVEL,OPTNAME)
given (EXPR) { [ when (EXPR) { ... } ]+ [ default { ... } ]? }
gmtime(EXPR)
goto LABEL
... gt ... String greater than.
hex(EXPR)
if (EXPR) { ... } [ elsif (EXPR) { ... } ... ] [ else { ... } ] or EXPR if EXPR
index(STR,SUBSTR[,OFFSET])
int(EXPR)
ioctl(FILEHANDLE,FUNCTION,SCALA)R
join(EXPR,LIST)
keys(%HASH)
kill(LIST)
last [LABEL]
... le ... String less than or equal.
length(EXPR)
link(OLDFILE,NEWFILE)
listen(SOCKET,QUEUESIZE)
local(LIST)
localtime(EXPR)
log(EXPR)
lstat(EXPR|FILEHANDLE|VAR)
... lt ... String less than.
m/PATTERN/iogsmx
__FILE__ Current (source) filename.
fileno(FILEHANDLE) return file descriptor from filehandle
flock(FILEHANDLE,OPERATION) lock an entire file with an advisory lock
fork create a new process just like this one
format [NAME] = Start of output format. Ended by a single dot (.) on a line.
formline PICTURE, LIST Backdoor into \"format\" processing.
getc[(FILEHANDLE)] get the next character from the filehandle
getgrent get group record given group user ID
getgrgid(GID) get group record given group user ID
getgrnam(NAME) get group record given group name
gethostbyaddr(ADDR,ADDRTYPE) get host record given name
gethostbyname(NAME) get host record given name
gethostent get next hosts record
getlogin return who logged in at this tty
getnetbyaddr(ADDR,ADDRTYPE) get network record given its address
getnetbyname(NAME) get networks record given name
getnetent get next networks record
getpeername(SOCKET) find the other end of a socket connection
getpgrp(PID) get process group
getppid get parent process ID
getpriority(WHICH,WHO) get current nice value
getprotobyname(NAME) get protocol record given name
getprotobynumber(NUMBER) get protocol record numeric protocol
getprotoent get next protocols record
getpwent get next passwd record
getpwnam(NAME) get passwd record given user login name
getpwuid(UID) get passwd record given user ID
getservbyname(NAME,PROTO) get services record given its name
getservbyport(PORT,PROTO) get services record given numeric port
getservent get next services record
getsockname(SOCKET) retrieve the sockaddr for a given socket
getsockopt(SOCKET,LEVEL,OPTNAME) get socket options on a given socket
glob EXPR expand filenames using wildcards. Synonym of <EXPR>.
gmtime(EXPR) convert UNIX time into record or string using Greenwich time
goto LABEL create spaghetti code
grep EXPR,LIST or grep {BLOCK} LIST Filters LIST via EXPR/BLOCK.
hex(EXPR) convert a hexadecimal string to a number
import patch a module's namespace into your own
index(STR,SUBSTR[,OFFSET]) find a substring within a string
int(EXPR) get the integer portion of a number
ioctl(FILEHANDLE,FUNCTION,SCALAR) device control system call
join(EXPR,LIST) join a list into a string using a separator
keys(%HASH) retrieve list of indices from a hash
kill(LIST) send a signal to a process or process group
last [LABEL] exit a block prematurely
lc [ EXPR ] Returns lowercased EXPR.
lcfirst [ EXPR ] Returns EXPR with lower-cased first letter.
length(EXPR) return the number of characters in a string
__LINE__ Current line in current source.
link(OLDFILE,NEWFILE) create a hard link in the filesystem
listen(SOCKET,QUEUESIZE) register your socket as a server
local(LIST) create a temporary value for a global variable
localtime(EXPR) convert UNIX time into record or string using local time
lock(THING) get a thread lock on a variable, subroutine, or method
log(EXPR) retrieve the natural logarithm for a number
lstat(EXPR|FILEHANDLE|VAR) stat a symbolic link
m/PATTERN/iogsmx match a string with a regular expression pattern
map EXPR, LIST or map {BLOCK} LIST Applies EXPR/BLOCK to elts of LIST.
method [NAME [(signature)]] { BODY } method NAME;
mkdir(FILENAME,MODE)
msgctl(ID,CMD,ARG)
msgget(KEY,FLAGS)
msgrcv(ID,VAR,SIZE,TYPE.FLAGS)
msgsnd(ID,MSG,FLAGS)
mkdir(FILENAME,MODE) create a directory
msgctl(ID,CMD,ARG) SysV IPC message control operations
msgget(KEY,FLAGS) get SysV IPC message queue
msgrcv(ID,VAR,SIZE,TYPE.FLAGS) receive a SysV IPC message from a message queue
msgsnd(ID,MSG,FLAGS) send a SysV IPC message to a message queue
my VAR or my (VAR1,...) Introduces a lexical variable ($VAR, @ARR, or %HASH).
our VAR or our (VAR1,...) Lexically enable a global variable ($V, @A, or %H).
... ne ... String inequality.
next [LABEL]
oct(EXPR)
open(FILEHANDLE[,EXPR])
opendir(DIRHANDLE,EXPR)
next [LABEL] iterate a block prematurely
no MODULE [SYMBOL1, ...] Partial reverse for `use'. Runs `unimport' method.
oct(EXPR) convert a string to an octal number
open(FILEHANDLE[,EXPR]) open a file, pipe, or descriptor
opendir(DIRHANDLE,EXPR) open a directory
ord(EXPR) ASCII value of the first char of the string.
pack(TEMPLATE,LIST)
our VAR or our (VAR1,...) Lexically enable a global variable ($V, @A, or %H).
pack(TEMPLATE,LIST) convert a list into a binary representation
package NAME Introduces package context.
__PACKAGE__ Current package.
pipe(READHANDLE,WRITEHANDLE) Create a pair of filehandles on ends of a pipe.
pop(ARRAY)
print [FILEHANDLE] [(LIST)]
printf [FILEHANDLE] (FORMAT,LIST)
push(ARRAY,LIST)
pop(ARRAY) remove the last element from an array and return it
pos STRING Set/Get end-position of the last match over this string, see \\G.
print [FILEHANDLE] [(LIST)] output a list to a filehandle
printf [FILEHANDLE] (FORMAT,LIST) output a formatted list to a filehandle
prototype \\&SUB Returns prototype of the function given a reference.
push(ARRAY,LIST) append one or more elements to an array
q/STRING/ Synonym for \\='STRING\\='
qq/STRING/ Synonym for \"STRING\"
qr/PATTERN/ compile pattern
quotemeta quote regular expression magic characters
qw/STRING/ quote a list of words
qx/STRING/ Synonym for \\=`STRING\\=`
rand[(EXPR)]
read(FILEHANDLE,SCALAR,LENGTH[,OFFSET])
readdir(DIRHANDLE)
readlink(EXPR)
recv(SOCKET,SCALAR,LEN,FLAGS)
redo [LABEL]
rename(OLDNAME,NEWNAME)
require [FILENAME | PERL_VERSION]
reset[(EXPR)]
return(LIST)
reverse(LIST)
rewinddir(DIRHANDLE)
rindex(STR,SUBSTR[,OFFSET])
rmdir(FILENAME)
s/PATTERN/REPLACEMENT/gieoxsm
say [FILEHANDLE] [(LIST)]
scalar(EXPR)
seek(FILEHANDLE,POSITION,WHENCE)
seekdir(DIRHANDLE,POS)
select(FILEHANDLE | RBITS,WBITS,EBITS,TIMEOUT)
semctl(ID,SEMNUM,CMD,ARG)
semget(KEY,NSEMS,SIZE,FLAGS)
semop(KEY,...)
send(SOCKET,MSG,FLAGS[,TO])
setgrent
sethostent(STAYOPEN)
setnetent(STAYOPEN)
setpgrp(PID,PGRP)
setpriority(WHICH,WHO,PRIORITY)
setprotoent(STAYOPEN)
setpwent
setservent(STAYOPEN)
setsockopt(SOCKET,LEVEL,OPTNAME,OPTVAL)
shift[(ARRAY)]
shmctl(ID,CMD,ARG)
shmget(KEY,SIZE,FLAGS)
shmread(ID,VAR,POS,SIZE)
shmwrite(ID,STRING,POS,SIZE)
shutdown(SOCKET,HOW)
sin(EXPR)
sleep[(EXPR)]
socket(SOCKET,DOMAIN,TYPE,PROTOCOL)
socketpair(SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL)
sort [SUBROUTINE] (LIST)
splice(ARRAY,OFFSET[,LENGTH[,LIST]])
split[(/PATTERN/[,EXPR[,LIMIT]])]
sprintf(FORMAT,LIST)
sqrt(EXPR)
srand(EXPR)
stat(EXPR|FILEHANDLE|VAR)
rand[(EXPR)] retrieve the next pseudorandom number
read(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) fixed-length buffered input
readdir(DIRHANDLE) get a directory from a directory handle
readline FH Synonym of <FH>.
readlink(EXPR) determine where a symbolic link is pointing
readpipe CMD Synonym of \\=`CMD\\=`.
recv(SOCKET,SCALAR,LEN,FLAGS) receive a message over a Socket
redo [LABEL] start this loop iteration over again
ref [ EXPR ] Type of EXPR when dereferenced.
rename(OLDNAME,NEWNAME) change a filename
require [FILENAME | PERL_VERSION] load from a library at runtime
reset[(EXPR)] clear all variables of a given name
return(LIST) get out of a function early
reverse(LIST) flip a string or a list
rewinddir(DIRHANDLE) reset directory handle
rindex(STR,SUBSTR[,OFFSET]) right-to-left substring search
rmdir(FILENAME) remove a directory
s/PATTERN/REPLACEMENT/gieoxsm replace a pattern with a string
say [FILEHANDLE] [(LIST)] output a list, appending a newline
scalar(EXPR) force a scalar context
seek(FILEHANDLE,POSITION,WHENCE) reposition file pointer
seekdir(DIRHANDLE,POS) reposition directory pointer
select(FILEHANDLE) reset default output or do I/O multiplexing
select(RBITS,WBITS,EBITS,TIMEOUT) do I/O multiplexing
semctl(ID,SEMNUM,CMD,ARG) SysV semaphore control operations
semget(KEY,NSEMS,SIZE,FLAGS) get set of SysV semaphores
semop(KEY,...) SysV semaphore operations
send(SOCKET,MSG,FLAGS[,TO]) send a message over a socket
setgrent prepare group file for use
sethostent(STAYOPEN) prepare hosts file for use
setnetent(STAYOPEN) prepare networks file for use
setpgrp(PID,PGRP) set the process group of a process
setpriority(WHICH,WHO,PRIORITY) Process set a process\\='s nice value
setprotoent(STAYOPEN) etwork prepare protocols file for use
setpwent prepare passwd file for use
setservent(STAYOPEN) prepare services file for use
setsockopt(SOCKET,LEVEL,OPTNAME,OPTVAL) set some socket options
shift[(ARRAY)] remove the first element of an array, and return it
shmctl(ID,CMD,ARG) SysV shared memory operations
shmget(KEY,SIZE,FLAGS) get SysV shared memory segment identifier
shmread(ID,VAR,POS,SIZE) read SysV shared memory
shmwrite(ID,STRING,POS,SIZE) write SysV shared memory
shutdown(SOCKET,HOW) close down just half of a socket connection
sin(EXPR) return the sine of a number
sleep[(EXPR)] block for some number of seconds
socket(SOCKET,DOMAIN,TYPE,PROTOCOL) create a socket
socketpair(SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL) create a pair of sockets
sort [SUBROUTINE] (LIST) sort a list of values
splice(ARRAY,OFFSET[,LENGTH[,LIST]]) add or remove elements anywhere
split[(/PATTERN/[,EXPR[,LIMIT]])] split up a string using a regexp
sprintf(FORMAT,LIST) formatted print into a string
sqrt(EXPR) square root function
srand(EXPR) seed the random number generator
stat(EXPR|FILEHANDLE|VAR) get a file\\='s status information
state VAR or state (VAR1,...) Introduces a static lexical variable
study[(SCALAR)]
study[(SCALAR)] no-op, formerly optimized input data for repeated searches
sub [NAME [(format)]] { BODY } sub NAME [(format)]; sub [(format)] {...}
substr(EXPR,OFFSET[,LEN])
symlink(OLDFILE,NEWFILE)
syscall(LIST)
sysread(FILEHANDLE,SCALAR,LENGTH[,OFFSET])
__SUB__ the current subroutine, or C<undef> if not in a subroutine
substr(EXPR,OFFSET[,LEN]) get or alter a portion of a string
symlink(OLDFILE,NEWFILE) create a symbolic link to a file
syscall(LIST) execute an arbitrary system call
sysopen FH, FILENAME, MODE [, PERM] (MODE is numeric, see Fcntl.)
sysread(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) fixed-length unbuffered input
sysseek(FILEHANDLE,POSITION,WHENCE) position I/O pointer on handle
system([TRUENAME] ARGV0 [,ARGV]) or system(SHELL_COMMAND_LINE)
syswrite(FILEHANDLE,SCALAR,LENGTH[,OFFSET])
tell[(FILEHANDLE)]
telldir(DIRHANDLE)
time
times
tr/SEARCHLIST/REPLACEMENTLIST/cds
truncate(FILE|EXPR,LENGTH)
umask[(EXPR)]
undef[(EXPR)]
unless (EXPR) { ... } [ else { ... } ] or EXPR unless EXPR
unlink(LIST)
unpack(TEMPLATE,EXPR)
unshift(ARRAY,LIST)
until (EXPR) { ... } EXPR until EXPR
utime(LIST)
values(%HASH)
vec(EXPR,OFFSET,BITS)
wait
waitpid(PID,FLAGS)
syswrite(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) fixed-length unbuffered output
tell[(FILEHANDLE)] get current seekpointer on a filehandle
telldir(DIRHANDLE) get current seekpointer on a directory handle
tie VAR, CLASS, LIST Hide an object behind a simple Perl variable.
tied Returns internal object for a tied data.
time return number of seconds since 1970
times return elapsed time for self and child processes
tr/SEARCHLIST/REPLACEMENTLIST/cds transliterate a string
truncate(FILE|EXPR,LENGTH) shorten a file
uc [ EXPR ] Returns upcased EXPR.
ucfirst [ EXPR ] Returns EXPR with upcased first letter.
umask[(EXPR)] set file creation mode mask
undef[(EXPR)] remove a variable or function definition
unlink(LIST) remove one link to a file
unpack(TEMPLATE,EXPR) convert binary structure into normal perl variables
unshift(ARRAY,LIST) prepend more elements to the beginning of a list
untie VAR Unlink an object from a simple Perl variable.
use MODULE [SYMBOL1, ...] Compile-time `require' with consequent `import'.
utime(LIST) set a file\\='s last access and modify times
values(%HASH) return a list of the values in a hash
vec(EXPR,OFFSET,BITS) test or set particular bits in a string
wait wait for any child process to die
waitpid(PID,FLAGS) wait for a particular child process to die
wantarray Returns true if the sub/eval is called in list context.
warn(LIST)
while (EXPR) { ... } EXPR while EXPR
write[(EXPR|FILEHANDLE)]
... x ... Repeat string or array.
x= ... Repetition assignment.
y/SEARCHLIST/REPLACEMENTLIST/
... | ... Bitwise or.
... || ... Logical or.
... // ... Defined-or.
~ ... Unary bitwise complement.
warn(LIST) print debugging info
write[(EXPR|FILEHANDLE)] print a picture record
y/SEARCHLIST/REPLACEMENTLIST/ transliterate a string
#! OS interpreter indicator. If contains `perl', used for options, and -x.
AUTOLOAD {...} Shorthand for `sub AUTOLOAD {...}'.
CORE:: Prefix to access builtin function if imported sub obscures it.
SUPER:: Prefix to lookup for a method in @ISA classes.
DESTROY Shorthand for `sub DESTROY {...}'.
... EQ ... Obsolete synonym of `eq'.
... GE ... Obsolete synonym of `ge'.
... GT ... Obsolete synonym of `gt'.
... LE ... Obsolete synonym of `le'.
... LT ... Obsolete synonym of `lt'.
... NE ... Obsolete synonym of `ne'.
abs [ EXPR ] absolute value
... and ... Low-precedence synonym for &&.
bless REFERENCE [, PACKAGE] Makes reference into an object of a package.
chomp [LIST] Strips $/ off LIST/$_. Returns count. Special if $/ eq \\='\\='!
chr Converts a number to char with the same ordinal.
else Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}.
elsif Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}.
exists $HASH{KEY} True if the key exists.
fc EXPR Returns the casefolded version of EXPR.
format [NAME] = Start of output format. Ended by a single dot (.) on a line.
formline PICTURE, LIST Backdoor into \"format\" processing.
glob EXPR Synonym of <EXPR>.
lc [ EXPR ] Returns lowercased EXPR.
lcfirst [ EXPR ] Returns EXPR with lower-cased first letter.
grep EXPR,LIST or grep {BLOCK} LIST Filters LIST via EXPR/BLOCK.
map EXPR, LIST or map {BLOCK} LIST Applies EXPR/BLOCK to elts of LIST.
no MODULE [SYMBOL1, ...] Partial reverse for `use'. Runs `unimport' method.
not ... Low-precedence synonym for ! - negation.
... or ... Low-precedence synonym for ||.
pos STRING Set/Get end-position of the last match over this string, see \\G.
prototype FUNC Returns the prototype of a function as a string, or undef.
quotemeta [ EXPR ] Quote regexp metacharacters.
qw/WORD1 .../ Synonym of split(\\='\\=', \\='WORD1 ...\\=')
readline FH Synonym of <FH>.
readpipe CMD Synonym of \\=`CMD\\=`.
ref [ EXPR ] Type of EXPR when dereferenced.
sysopen FH, FILENAME, MODE [, PERM] (MODE is numeric, see Fcntl.)
tie VAR, CLASS, LIST Hide an object behind a simple Perl variable.
tied Returns internal object for a tied data.
uc [ EXPR ] Returns upcased EXPR.
ucfirst [ EXPR ] Returns EXPR with upcased first letter.
untie VAR Unlink an object from a simple Perl variable.
use MODULE [SYMBOL1, ...] Compile-time `require' with consequent `import'.
... xor ... Low-precedence synonym for exclusive or.
prototype \\&SUB Returns prototype of the function given a reference.
default { ... } default case for given/when block
defer { ... } run this block after the containing block.
for (EXPR;EXPR;EXPR) { ... }
foreach [VAR] (@ARRAY) { ... }
given (EXPR) { [ when (EXPR) { ... } ]+ [ default { ... } ]? }
if (EXPR) { ... } [ elsif (EXPR) { ... } ... ] [ else { ... } ] or EXPR if EXPR
unless (EXPR) { ... } [ else { ... } ] or EXPR unless EXPR
until (EXPR) { ... } EXPR until EXPR
while (EXPR) { ... } EXPR while EXPR
=head1 Top-level heading.
=head2 Second-level heading.
=head3 Third-level heading.

View File

@ -1887,5 +1887,22 @@ to directory DIR."
(let ((project-current-directory-override dir))
(call-interactively command))))
;;;###autoload
(defun project-uniquify-dirname-transform (dirname)
"Uniquify name of directory DIRNAME using `project-name', if in a project.
If you set `uniquify-dirname-transform' to this function,
slash-separated components from `project-name' will be appended to
the buffer's directory name when buffers from two different projects
would otherwise have the same name."
(if-let (proj (project-current nil dirname))
(let ((root (project-root proj)))
(expand-file-name
(file-name-concat
(file-name-directory root)
(project-name proj)
(file-relative-name dirname root))))
dirname))
(provide 'project)
;;; project.el ends here

View File

@ -182,8 +182,10 @@ space (this means characters from ! to ~; or from code 33 to
:type 'hook)
(defcustom server-after-make-frame-hook nil
"Hook run when the Emacs server creates a client frame.
The created frame is selected when the hook is called."
"Hook run when the Emacs server starts using a client frame.
The client frame is selected when the hook is called.
The client frame could be a newly-created frame, or an
existing frame reused for this purpose."
:type 'hook
:version "27.1")

View File

@ -215,6 +215,99 @@ Preserve the modified states of the buffers and set `tar-data-swapped'."
"Round S up to the next multiple of 512."
(ash (ash (+ s 511) -9) 9))
;; Reference:
;; https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_02
(defconst pax-extended-attribute-record-regexp
;; We omit attributes that are "reserved" by Posix, since no
;; processing has been defined for them.
"\\([0-9]+\\) \\(gid\\|gname\\|hdrcharset\\|linkpath\\|mtime\\|path\\|size\\|uid\\|uname\\)="
"Regular expression for looking up extended attributes in a
Posix-standard pax extended header of a tar file.
Only attributes that `tar-mode' can grok are mentioned.")
(defconst pax-gid-index 0)
(defconst pax-gname-index 1)
(defconst pax-linkpath-index 2)
(defconst pax-mtime-index 3)
(defconst pax-path-index 4)
(defconst pax-size-index 5)
(defconst pax-uid-index 6)
(defconst pax-uname-index 7)
(defsubst pax-header-gid (attr-vec)
(aref attr-vec pax-gid-index))
(defsubst pax-header-gname (attr-vec)
(aref attr-vec pax-gname-index))
(defsubst pax-header-linkpath (attr-vec)
(aref attr-vec pax-linkpath-index))
(defsubst pax-header-mtime (attr-vec)
(aref attr-vec pax-mtime-index))
(defsubst pax-header-path (attr-vec)
(aref attr-vec pax-path-index))
(defsubst pax-header-size (attr-vec)
(aref attr-vec pax-size-index))
(defsubst pax-header-uid (attr-vec)
(aref attr-vec pax-uid-index))
(defsubst pax-header-uname (attr-vec)
(aref attr-vec pax-uid-index))
(defsubst pax-decode-string (str coding)
(if str
(decode-coding-string str coding)
str))
(defvar tar-attr-vector '[nil nil nil nil nil nil nil nil])
(defun tar-parse-pax-extended-header (pos)
"Parse a pax external header of a Posix-format tar file."
(let ((end (+ pos 512))
(result tar-attr-vector)
(coding 'utf-8-unix)
attr value record-len value-len)
(dotimes (i 8)
(aset result i nil))
(goto-char pos)
(while (and (< pos end)
(re-search-forward pax-extended-attribute-record-regexp
end 'move))
(setq record-len (string-to-number (match-string 1))
attr (match-string 2)
value-len (- record-len
(length (match-string 1))
1
(length (match-string 2))
2)
value (buffer-substring (point) (+ (point) value-len)))
(setq pos (goto-char (+ (point) value-len 1)))
(cond
((equal attr "gid")
(aset result pax-gid-index value))
((equal attr "gname")
(aset result pax-gname-index value))
((equal attr "linkpath")
(aset result pax-linkpath-index value))
((equal attr "mtime")
(aset result pax-mtime-index (string-to-number value)))
((equal attr "path")
(aset result pax-path-index value))
((equal attr "size")
(aset result pax-size-index value))
((equal attr "uid")
(aset result pax-uid-index value))
((equal attr "uname")
(aset result pax-uname-index value))
((equal attr "hdrcharset")
(setq coding (if (equal value "BINARY") 'no-conversion 'utf-8-unix))))
(setq pos (+ pos (skip-chars-forward "\000"))))
;; Decode string-valued attributes.
(aset result pax-gname-index
(pax-decode-string (aref result pax-gname-index) coding))
(aset result pax-linkpath-index
(pax-decode-string (aref result pax-linkpath-index) coding))
(aset result pax-path-index
(pax-decode-string (aref result pax-path-index) coding))
(aset result pax-uname-index
(pax-decode-string (aref result pax-uname-index) coding))
result))
(defun tar-header-block-tokenize (pos coding &optional disable-slash)
"Return a `tar-header' structure.
This is a list of name, mode, uid, gid, size,
@ -271,67 +364,112 @@ of the file header. This is used for \"old GNU\" Tar format."
(if (and (null link-p) (null disable-slash) (string-match "/\\'" name))
(setq link-p 5)) ; directory
(if (and (equal name "././@LongLink")
;; Supposedly @LongLink is only used for GNUTAR
;; format (i.e. "ustar ") but some POSIX Tar files
;; (with "ustar\0") have been seen using it as well.
(member magic-str '("ustar " "ustar\0")))
;; This is a GNU Tar long-file-name header.
(let* ((size (tar-parse-octal-integer
string tar-size-offset tar-time-offset))
;; The long name is in the next 512-byte block.
;; We've already moved POS there, when we computed
;; STRING above.
(name (decode-coding-string
;; -1 so as to strip the terminating 0 byte.
(buffer-substring pos (+ pos size -1)) coding))
;; Tokenize the header of the _real_ file entry,
;; which is further 512 bytes into the archive.
(descriptor (tar-header-block-tokenize
(+ pos (tar-roundup-512 size)) coding
;; Don't intuit directories from
;; the trailing slash, because the
;; truncated name might by chance end
;; in a slash.
'ignore-trailing-slash)))
;; Fix the descriptor of the real file entry by using
;; the information from the long name entry.
(cond
((eq link-p (- ?L ?0)) ;GNUTYPE_LONGNAME.
(setf (tar-header-name descriptor) name))
((eq link-p (- ?K ?0)) ;GNUTYPE_LONGLINK.
(setf (tar-header-link-name descriptor) name))
(t
(message "Unrecognized GNU Tar @LongLink format")))
;; Fix the "link-type" attribute, based on the long name.
(if (and (null (tar-header-link-type descriptor))
(string-match "/\\'" name))
(setf (tar-header-link-type descriptor) 5)) ; directory
(setf (tar-header-header-start descriptor)
(copy-marker (- pos 512) t))
descriptor)
(if (member magic-str '("ustar " "ustar\0"))
(if (equal name "././@LongLink")
;; Supposedly @LongLink is only used for GNUTAR
;; format (i.e. "ustar ") but some POSIX Tar files
;; (with "ustar\0") have been seen using it as well.
;; This is a GNU Tar long-file-name header.
(let* ((size (tar-parse-octal-integer
string tar-size-offset tar-time-offset))
;; The long name is in the next 512-byte block.
;; We've already moved POS there, when we
;; computed STRING above.
(name (decode-coding-string
;; -1 so as to strip the terminating 0 byte.
(buffer-substring pos (+ pos size -1)) coding))
;; Tokenize the header of the _real_ file entry,
;; which is further 512 bytes into the archive.
(descriptor (tar-header-block-tokenize
(+ pos (tar-roundup-512 size)) coding
;; Don't intuit directories from
;; the trailing slash, because the
;; truncated name might by chance end
;; in a slash.
'ignore-trailing-slash)))
;; Fix the descriptor of the real file entry by using
;; the information from the long name entry.
(cond
((eq link-p (- ?L ?0)) ;GNUTYPE_LONGNAME.
(setf (tar-header-name descriptor) name))
((eq link-p (- ?K ?0)) ;GNUTYPE_LONGLINK.
(setf (tar-header-link-name descriptor) name))
(t
(message "Unrecognized GNU Tar @LongLink format")))
;; Fix the "link-type" attribute, based on the long name.
(if (and (null (tar-header-link-type descriptor))
(string-match "/\\'" name))
(setf (tar-header-link-type descriptor) 5)) ; directory
(setf (tar-header-header-start descriptor)
(copy-marker (- pos 512) t))
descriptor)
;; Posix pax extended header. FIXME: support ?g as well.
(if (eq link-p (- ?x ?0))
;; Get whatever attributes are in the extended header,
(let* ((pax-attrs (tar-parse-pax-extended-header pos))
(gid (pax-header-gid pax-attrs))
(gname (pax-header-gname pax-attrs))
(linkpath (pax-header-linkpath pax-attrs))
(mtime (pax-header-mtime pax-attrs))
(path (pax-header-path pax-attrs))
(size (pax-header-size pax-attrs))
(uid (pax-header-uid pax-attrs))
(uname (pax-header-uname pax-attrs))
;; Tokenize the header of the _real_ file entry,
;; which is further 512 bytes into the archive.
(descriptor
(tar-header-block-tokenize (+ pos 512) coding
'ignore-trailing-slash)))
;; Fix the descriptor of the real file entry by
;; overriding some of the fields with the information
;; from the extended header.
(if gid
(setf (tar-header-gid descriptor) gid))
(if gname
(setf (tar-header-gname descriptor) gname))
(if linkpath
(setf (tar-header-link-name descriptor) linkpath))
(if mtime
(setf (tar-header-date descriptor) mtime))
(if path
(setf (tar-header-name descriptor) path))
(if size
(setf (tar-header-size descriptor) size))
(if uid
(setf (tar-header-uid descriptor) uid))
(if uname
(setf (tar-header-uname descriptor) uname))
descriptor)
(make-tar-header
(copy-marker pos nil)
name
(tar-parse-octal-integer string tar-mode-offset tar-uid-offset)
(tar-parse-octal-integer string tar-uid-offset tar-gid-offset)
(tar-parse-octal-integer string tar-gid-offset tar-size-offset)
(tar-parse-octal-integer string tar-size-offset tar-time-offset)
(tar-parse-octal-integer string tar-time-offset tar-chk-offset)
(tar-parse-octal-integer string tar-chk-offset tar-linkp-offset)
link-p
linkname
uname-valid-p
(when uname-valid-p
(decode-coding-string
(substring string tar-uname-offset uname-end) coding))
(when uname-valid-p
(decode-coding-string
(substring string tar-gname-offset gname-end) coding))
(tar-parse-octal-integer string tar-dmaj-offset tar-dmin-offset)
(tar-parse-octal-integer string tar-dmin-offset tar-prefix-offset)
))))))
(make-tar-header
(copy-marker pos nil)
name
(tar-parse-octal-integer string tar-mode-offset
tar-uid-offset)
(tar-parse-octal-integer string tar-uid-offset
tar-gid-offset)
(tar-parse-octal-integer string tar-gid-offset
tar-size-offset)
(tar-parse-octal-integer string tar-size-offset
tar-time-offset)
(tar-parse-octal-integer string tar-time-offset
tar-chk-offset)
(tar-parse-octal-integer string tar-chk-offset
tar-linkp-offset)
link-p
linkname
uname-valid-p
(when uname-valid-p
(decode-coding-string
(substring string tar-uname-offset uname-end) coding))
(when uname-valid-p
(decode-coding-string
(substring string tar-gname-offset gname-end) coding))
(tar-parse-octal-integer string tar-dmaj-offset
tar-dmin-offset)
(tar-parse-octal-integer string tar-dmin-offset
tar-prefix-offset)
))))))))
;; Pseudo-field.
(defun tar-header-data-end (descriptor)

View File

@ -168,6 +168,32 @@ This can be handy when you have deep parallel hierarchies."
That means that when `buffer-file-name' is set to nil, `list-buffers-directory'
contains the name of the directory which the buffer is visiting.")
(defcustom uniquify-dirname-transform #'identity
"Function to transform buffer's directory name when uniquifying buffer's name.
When `uniquify-buffer-name-style' is non-nil, Emacs makes buffer
names unique by adding components of the buffer's directory name
until the resulting name is unique. This function is used to
transform the buffer's directory name during this uniquifying
process, allowing the unique buffer name to include strings
from sources other than the buffer's directory. The default is
`identity', so the unmodified buffer's directory name is used for
uniquifying.
This function is called with the buffer's directory name and
should return a string which names a file (that does not need to
actually exist in the filesystem); the components of this file
name will then be used to uniquify the buffer's name.
To include components from the `project-name' of the buffer, set
this variable to `project-uniquify-dirname-transform'."
:type '(choice (function-item :tag "Use directory name as-is" identity)
(function-item :tag "Include project name in directory name"
#'project-uniquify-dirname-transform)
function)
:version "30.1"
:group 'uniquify)
;;; Utilities
;; uniquify-fix-list data structure
@ -209,7 +235,8 @@ this rationalization."
;; this buffer.
(with-current-buffer newbuf (setq uniquify-managed nil))
(when dirname
(setq dirname (expand-file-name (directory-file-name dirname)))
(setq dirname (funcall uniquify-dirname-transform
(expand-file-name (directory-file-name dirname))))
(let ((fix-list (list (uniquify-make-item base dirname newbuf
nil)))
items)
@ -268,10 +295,11 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil."
(if (memq major-mode uniquify-list-buffers-directory-modes)
list-buffers-directory))))
(when filename
(directory-file-name
(file-name-directory
(expand-file-name
(directory-file-name filename))))))))
(funcall uniquify-dirname-transform
(directory-file-name
(file-name-directory
(expand-file-name
(directory-file-name filename)))))))))
(defun uniquify-rerationalize-w/o-cb (fix-list)
"Re-rationalize the buffers in FIX-LIST, but ignoring `current-buffer'."

View File

@ -1115,14 +1115,24 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
{
Lisp_Object idxval = POP;
Lisp_Object arrayval = TOP;
if (!FIXNUMP (idxval))
{
record_in_backtrace (Qaref, &TOP, 2);
wrong_type_argument (Qfixnump, idxval);
}
ptrdiff_t size;
ptrdiff_t idx;
if (((VECTORP (arrayval) && (size = ASIZE (arrayval), true))
|| (RECORDP (arrayval) && (size = PVSIZE (arrayval), true)))
&& FIXNUMP (idxval)
&& (idx = XFIXNUM (idxval),
idx >= 0 && idx < size))
TOP = AREF (arrayval, idx);
|| (RECORDP (arrayval) && (size = PVSIZE (arrayval), true))))
{
ptrdiff_t idx = XFIXNUM (idxval);
if (idx >= 0 && idx < size)
TOP = AREF (arrayval, idx);
else
{
record_in_backtrace (Qaref, &TOP, 2);
args_out_of_range (arrayval, idxval);
}
}
else
TOP = Faref (arrayval, idxval);
NEXT;
@ -1133,16 +1143,26 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
Lisp_Object newelt = POP;
Lisp_Object idxval = POP;
Lisp_Object arrayval = TOP;
ptrdiff_t size;
ptrdiff_t idx;
if (((VECTORP (arrayval) && (size = ASIZE (arrayval), true))
|| (RECORDP (arrayval) && (size = PVSIZE (arrayval), true)))
&& FIXNUMP (idxval)
&& (idx = XFIXNUM (idxval),
idx >= 0 && idx < size))
if (!FIXNUMP (idxval))
{
ASET (arrayval, idx, newelt);
TOP = newelt;
record_in_backtrace (Qaset, &TOP, 3);
wrong_type_argument (Qfixnump, idxval);
}
ptrdiff_t size;
if (((VECTORP (arrayval) && (size = ASIZE (arrayval), true))
|| (RECORDP (arrayval) && (size = PVSIZE (arrayval), true))))
{
ptrdiff_t idx = XFIXNUM (idxval);
if (idx >= 0 && idx < size)
{
ASET (arrayval, idx, newelt);
TOP = newelt;
}
else
{
record_in_backtrace (Qaset, &TOP, 3);
args_out_of_range (arrayval, idxval);
}
}
else
TOP = Faset (arrayval, idxval, newelt);

View File

@ -4116,6 +4116,8 @@ syms_of_data (void)
DEFSYM (Qelt, "elt");
DEFSYM (Qsetcar, "setcar");
DEFSYM (Qsetcdr, "setcdr");
DEFSYM (Qaref, "aref");
DEFSYM (Qaset, "aset");
error_tail = pure_cons (Qerror, Qnil);

View File

@ -780,6 +780,11 @@ inner loops respectively."
;; (+ 0 -0.0) etc
(let ((x (bytecomp-test-identity -0.0)))
(list x (+ x) (+ 0 x) (+ x 0) (+ 1 2 -3 x) (+ 0 x 0)))
;; Unary comparisons: keep side-effect, return t
(let ((x 0))
(list (= (setq x 1))
x))
)
"List of expressions for cross-testing interpreted and compiled code.")
@ -1953,6 +1958,15 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \
((setcdr c 5) (wrong-type-argument consp c))
((nth 2 "abcd") (wrong-type-argument listp "abcd"))
((elt (x y . z) 2) (wrong-type-argument listp z))
((aref [2 3 5] p) (wrong-type-argument fixnump p))
((aref #s(a b c) p) (wrong-type-argument fixnump p))
((aref "abc" p) (wrong-type-argument fixnump p))
((aref [2 3 5] 3) (args-out-of-range [2 3 5] 3))
((aref #s(a b c) 3) (args-out-of-range #s(a b c) 3))
((aset [2 3 5] q 1) (wrong-type-argument fixnump q))
((aset #s(a b c) q 1) (wrong-type-argument fixnump q))
((aset [2 3 5] -1 1) (args-out-of-range [2 3 5] -1))
((aset #s(a b c) -1 1) (args-out-of-range #s(a b c) -1))
;; Many more to add
))
@ -1967,17 +1981,17 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \
;; Test both calling the function directly, and calling
;; a byte-compiled η-expansion (lambda (ARGS...) (FUN ARGS...))
;; which should turn the function call into a byte-op.
(dolist (byte-op '(nil t))
(ert-info ((prin1-to-string byte-op) :prefix "byte-op: ")
(let* ((fun
(if byte-op
(let* ((nargs (length (cdr call)))
(formals (mapcar (lambda (i)
(intern (format "x%d" i)))
(number-sequence 1 nargs))))
(byte-compile
`(lambda ,formals (,fun-sym ,@formals))))
fun-sym))
(dolist (mode '(funcall byte-op))
(ert-info ((symbol-name mode) :prefix "mode: ")
(let* ((fun (pcase-exhaustive mode
('funcall fun-sym)
('byte-op
(let* ((nargs (length (cdr call)))
(formals (mapcar (lambda (i)
(intern (format "x%d" i)))
(number-sequence 1 nargs))))
(byte-compile
`(lambda ,formals (,fun-sym ,@formals)))))))
(error-frame (bytecomp-tests--error-frame fun actuals)))
(should (consp error-frame))
(should (equal (car error-frame) (list 'error expected-error)))

View File

@ -355,5 +355,28 @@ Expected initialization file: `%s'\"
;; (should (equal (lisp-current-defun-name) "defblarg")))
)
(ert-deftest test-font-lock-keywords ()
"Keywords should be fontified in `font-lock-keyword-face`."
(with-temp-buffer
(emacs-lisp-mode)
(mapc (lambda (el-keyword)
(erase-buffer)
(insert (format "(%s some-symbol () \"hello\"" el-keyword))
(font-lock-ensure)
;; Verify face property throughout the keyword
(let* ((begin (1+ (point-min)))
(end (1- (+ begin (length el-keyword)))))
(mapc (lambda (pos)
(should (equal (get-text-property pos 'face)
'font-lock-keyword-face)))
(number-sequence begin end))))
'("defsubst" "cl-defsubst" "define-inline"
"define-advice" "defadvice" "defalias"
"define-derived-mode" "define-minor-mode"
"define-generic-mode" "define-global-minor-mode"
"define-globalized-minor-mode" "define-skeleton"
"define-widget" "ert-deftest" "defconst" "defcustom"
"defvaralias" "defvar-local" "defface" "define-error"))))
(provide 'lisp-mode-tests)
;;; lisp-mode-tests.el ends here

View File

@ -47,10 +47,11 @@
(should (equal
(file-name-directory (image-dired-thumb-name "foo.jpg"))
(file-name-directory (image-dired-thumb-name "/tmp/foo.jpg"))))
(should (equal (file-name-nondirectory
;; The checksum is based on the file name.
(image-dired-thumb-name "/some/path/foo.jpg"))
"dc4e6f7068157023e7f2e8362d15bdd2e3ca89e4.jpg"))
(should
(let* ((test-fn "/some/path/foo.jpg")
(thumb-fn (image-dired-thumb-name test-fn)))
(equal (file-name-nondirectory thumb-fn)
(concat (sha1 (expand-file-name test-fn)) ".jpg"))))
(should (equal (file-name-extension
(image-dired-thumb-name "foo.gif"))
"jpg")))))
@ -62,8 +63,12 @@
(should (equal
(file-name-nondirectory (image-dired-thumb-name "foo.jpg"))
(file-name-nondirectory (image-dired-thumb-name "/tmp/foo.jpg"))))
(should (equal (file-name-split (image-dired-thumb-name "/tmp/foo.jpg"))
'("" "tmp" ".image-dired" "foo.jpg.thumb.jpg")))
;; The cdr below avoids the system dependency in the car of the
;; list returned by 'file-name-split': it's "" on Posix systems,
;; but the drive letter on MS-Windows.
(should (equal (cdr (file-name-split
(image-dired-thumb-name "/tmp/foo.jpg")))
'("tmp" ".image-dired" "foo.jpg.thumb.jpg")))
(should (equal (file-name-nondirectory
(image-dired-thumb-name "foo.jpg"))
"foo.jpg.thumb.jpg"))))

View File

@ -44,6 +44,17 @@
"Move to the column under ATTRIBUTE in the current proced buffer."
(move-to-column (string-match attribute proced-header-line)))
(defun proced--assert-process-valid-pid-refinement (pid)
"Fail unless the process at point could be present after a refinment using PID."
(proced--move-to-column "PID")
(let ((pid-equal (string= pid (word-at-point))))
(should
(or pid-equal
;; Guard against the unlikely event a platform doesn't support PPID
(when (string-match "PPID" proced-header-line)
(proced--move-to-column "PPID")
(string= pid (word-at-point)))))))
(ert-deftest proced-format-test ()
(dolist (format '(short medium long verbose))
(proced--within-buffer
@ -75,22 +86,21 @@
(ert-deftest proced-refine-test ()
;;(skip-unless (memq system-type '(gnu/linux gnu/kfreebsd darwin)))
(proced--within-buffer
'medium
'verbose
'user
;; When refining on PID for process A, a process is kept if and only
;; if its PID are the same as process A, which more or less guarentees
;; the refinement will remove some processes.
;; if its PID is the same as process A, or its parent process is
;; process A.
(proced--move-to-column "PID")
(let ((pid (word-at-point)))
(proced-refine)
(while (not (eobp))
(proced--move-to-column "PID")
(should (string= pid (word-at-point)))
(proced--assert-process-valid-pid-refinement pid)
(forward-line)))))
(ert-deftest proced-refine-with-update-test ()
(proced--within-buffer
'medium
'verbose
'user
(proced--move-to-column "PID")
(let ((pid (word-at-point)))
@ -101,8 +111,7 @@
;; processes again, causing the test to fail.
(proced-update)
(while (not (eobp))
(proced--move-to-column "PID")
(should (string= pid (word-at-point)))
(proced--assert-process-valid-pid-refinement pid)
(forward-line)))))
(ert-deftest proced-update-preserves-pid-at-point-test ()

View File

@ -88,6 +88,21 @@
'("a/dir/" "b/dir/")))
(mapc #'kill-buffer bufs)))))
(ert-deftest uniquify-home ()
"uniquify works, albeit confusingly, in the presence of directories named \"~\""
(let (bufs)
(save-excursion
(push (find-file-noselect "~") bufs)
(push (find-file-noselect "./~") bufs)
(should (equal (mapcar #'buffer-name bufs)
'("~<test>" "~<>")))
(push (find-file-noselect "~/foo") bufs)
(push (find-file-noselect "./~/foo") bufs)
(should (equal (mapcar #'buffer-name bufs)
'("foo<~>" "foo</nonexistent>" "~<test>" "~<>")))
(while bufs
(kill-buffer (pop bufs))))))
(ert-deftest uniquify-rename-to-dir ()
"Giving a buffer a name which matches a directory doesn't rename the buffer"
(let ((uniquify-buffer-name-style 'forward)
@ -125,5 +140,23 @@ uniquify-trailing-separator-p is ignored"
(should (equal (buffer-name) "| foo"))
(kill-buffer)))
(require 'project)
(ert-deftest uniquify-project-transform ()
"`project-uniquify-dirname-transform' works"
(let ((uniquify-dirname-transform #'project-uniquify-dirname-transform)
(project-vc-name "foo1/bar")
bufs)
(save-excursion
(should (file-exists-p "../README"))
(push (find-file-noselect "../README") bufs)
(push (find-file-noselect "other/README") bufs)
(should (equal (mapcar #'buffer-name bufs)
'("README<other>" "README<bar>")))
(push (find-file-noselect "foo2/bar/README") bufs)
(should (equal (mapcar #'buffer-name bufs)
'("README<foo2/bar>" "README<other>" "README<foo1/bar>")))
(while bufs
(kill-buffer (pop bufs))))))
(provide 'uniquify-tests)
;;; uniquify-tests.el ends here