* buffer.c: New Lisp objects Qbuffer_list_update_hook and
Qclone_number. Remove external declaration of Qdelete_window.
(Fbuffer_list): Rewrite doc-string. Minor restructuring of
code.
(Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer): Run
Qbuffer_list_update_hook if allowed.
(Fother_buffer): Rewrite doc-string. Major rewrite for new
buffer list implementation.
(other_buffer_safely): New function.
(Fkill_buffer): Replace call to replace_buffer_in_all_windows by
calls to replace_buffer_in_windows and
replace_buffer_in_windows_safely. Run Qbuffer_list_update_hook
if allowed.
(record_buffer): Inhibit quitting and rewrite using quittable
functions. Run Qbuffer_list_update_hook if allowed.
(Frecord_buffer, Funrecord_buffer): New functions.
(switch_to_buffer_1, Fswitch_to_buffer): Remove. Move
switch-to-buffer to window.el.
(bury-buffer): Move to window.el.
(Vbuffer_list_update_hook): New variable.
* lisp.h (other_buffer_safely): Add prototype in buffer.c
section.
* window.h (resize_frame_windows): Move up in code.
(Fwindow_frame): Remove EXFUN.
(replace_buffer_in_all_windows): Remove prototype.
(replace_buffer_in_windows_safely): Add prototype.
* window.c: Declare Qdelete_window static again. Move down
declaration of select_count.
(Fnext_window, Fprevious_window): Rewrite doc-strings.
(Fother_window): Move to window.el.
(window_loop): Remove DELETE_BUFFER_WINDOWS and UNSHOW_BUFFER
cases. Add REPLACE_BUFFER_IN_WINDOWS_SAFELY case.
(Fdelete_windows_on, Freplace_buffer_in_windows): Move to
window.el.
(replace_buffer_in_windows): Implement by calling
Qreplace_buffer_in_windows.
(replace_buffer_in_all_windows): Remove with some functionality
moved into replace_buffer_in_windows_safely.
(replace_buffer_in_windows_safely): New function.
(select_window_norecord, select_frame_norecord): Move in front
of run_window_configuration_change_hook. Remove now obsolete
declarations.
(Fset_window_buffer): Rewrite doc-string. Call
Qrecord_window_buffer.
(keys_of_window): Move binding for other-window to window.el.
* loadup.el (top-level): Load window before files for the sake
of replace-buffer-in-windows.
* files.el (read-buffer-to-switch)
(switch-to-buffer-other-window)
(switch-to-buffer-other-frame, display-buffer-other-frame): Move
to window.el.
* simple.el (get-next-valid-buffer, last-buffer, next-buffer)
(previous-buffer): Move to window.el.
* bindings.el (unbury-buffer): Move to window.el.
* window.el (delete-other-windows-vertically): Move after
definition of delete-other-windows.
(other-window, delete-windows-on, replace-buffer-in-windows):
Move here from window.c.
(record-window-buffer, unrecord-window-buffer)
(set-window-buffer-start-and-point, switch-to-prev-buffer)
(switch-to-next-buffer): New functions.
(get-next-valid-buffer, last-buffer, next-buffer): Move here
from simple.el. Call switch-to-next-buffer.
(previous-buffer): Move here from simple.el. Call
switch-to-prev-buffer.
(bury-buffer): Move here from buffer.c. Switch to previous
buffer when window cannot be deleted.
(unbury-buffer): Move here from bindings.el.
(ctl-x-map): Move binding for other-window from window.c to
here.
(read-buffer-to-switch, switch-to-buffer-other-window)
(switch-to-buffer-other-frame): Move here from files.el.
(normalize-buffer-to-switch-to): New functions.
(switch-to-buffer): Move here from buffer.c. Use
read-buffer-to-switch and normalize-buffer-to-switch-to.
* lisp/files.el (set-auto-mode):
Also respect mode: entries at the end of the file.
* doc/lispref/modes.texi (Auto Major Mode):
Update for set-auto-mode changes.
* doc/emacs/custom.texi (Specifying File Variables):
Major modes no longer need come first.
* etc/NEWS: Mention this.
* lisp/files.el (hack-local-variables-prop-line): Small simplifications.
(hack-local-variables, hack-local-variables-prop-line):
If MODE-ONLY, return the mode, rather than just `t'.
* lisp/files.el (hack-one-local-variable-eval-safep):
Consider "eval: (foo-mode)" to be safe.
* doc/emacs/custom.texi (Specifying File Variables):
Deprecate using mode: for minor modes.
* etc/NEWS: Mention this.
* lisp/doc-view.el, lisp/net/soap-client.el:
Change "mode:" minor-mode file local variables to use "eval:".
lisp/files.el (file-size-human-readable): Produce one digit after
decimal, like "ls -lh" does.
lisp/ls-lisp.el (ls-lisp-format-file-size): Allow for 7 characters in
the file size representation.
lisp/files.el (file-size-human-readable): New function.
lisp/ls-lisp.el (ls-lisp-format-file-size): Use it, instead of
computing the representation inline. Don't require `cl'.
* lisp/simple.el: Lisp reimplement of list-processes. Based on an
earlier reimplementation by Leo Liu, but using tabulated-list.el.
(process-menu-mode): New major mode.
(list-processes--refresh, list-processes):
(process-menu-visit-buffer): New functions.
* lisp/files.el (save-buffers-kill-emacs): Don't assume any return
value of list-processes, which is undocumented anyway.
* lisp/files.el (after-find-file-from-revert-buffer): Remove variable.
(after-find-file): Dont' bind it.
(revert-buffer-in-progress-p): New variable.
(revert-buffer): Bind it.
Pass nil for `after-find-file-from-revert-buffer'.
* lisp/saveplace.el (save-place-find-file-hook): Use new variable
`rever-buffer-in-progress-p', not `after-find-file-from-revert-buffer'.
* etc/NEWS: New variable `revert-buffer-in-progress-p'.
lisp/files.el (file-ownership-preserved-p): Pass `integer' as an
explicit 2nd argument to `file-attributes'. If the file's owner
is the Administrators group on Windows, and the current user is
Administrator, consider that a match.
lisp/server.el (server-ensure-safe-dir): Consider server directory
safe on MS-Windows if its owner is the Administrators group while
the current Emacs user is Administrator. Use `=' to compare
numerical UIDs, since they could be integers or floats.
* lisp/files.el (dir-locals-collect-variables):
Add the ability to exclude subdirectories.
* doc/emacs/custom.texi (Directory Variables):
Give an example of excluding subdirectories.
* doc/lispref/variables.texi (Directory Local Variables):
Mention `(subdirs . nil)' alist element.
* etc/NEWS: Mention this addition.
* lisp/dired-x.el (dired-omit-here-always): Add `(subdirs . nil)' to locals.
* lisp/files.el (hack-local-variables-confirm, hack-local-variables-filter):
Doc fix (say _which_ directory `dir-name' is).
(hack-dir-local-variables): Fix setting of `dir-name'.
Previous value seems clearly wrong. Eg put a risky variable in a
dir-locals file, visit a file in a subdirectory, see which directory
it says the risky variables come from. It should be the one with the
associated directory variables, not the one containing the visited file.
* lisp/files.el (dir-locals-find-file): Doc fix.
Fix the check for cache elements that have no associated file,
and the mtime check for those that do.
Still to do: some places that use dir-locals-find-file assume the
result is always a file, which is not true. (The function name is
misleading.)
* lread.c (Qdir_ok): New constant.
(syms_of_lread): Initialize it.
(openp): Don't ignore directories if the predicate returns dir-ok.
Fixes: debbugs:7924
* lisp/files.el (lexical-binding): Add a safe-local-variable property.
* lisp/emacs-lisp/byte-opt.el (byte-inline-lapcode): Check how many elements
are added to the stack.
(byte-compile-splice-in-already-compiled-code): Don't touch lexical nor
byte-compile-depth now that byte-inline-lapcode does it for us.
(byte-compile-inline-expand): Don't inline dynbind byte code into
lexbind code, since it has to be done differently.
* lisp/emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
Correctly extract arglist from `closure's.
(byte-compile-cl-warn): Compiler-macros are run earlier now.
(byte-compile-top-level): Bind byte-compile-lexical-environment to nil,
except for lambdas.
(byte-compile-form): Don't run the compiler-macro expander here.
(byte-compile-let): Merge with byte-compile-let*.
Don't preserve-body-value if the body's value was discarded.
* lisp/emacs-lisp/cconv.el (cconv--set-diff, cconv--set-diff-map)
(cconv--map-diff, cconv--map-diff-elem, cconv--map-diff-set): New funs.
(cconv--env-var): New constant.
(cconv-closure-convert-rec): Use it and use them. Fix a typo that
ended up forgetting to remove entries from lmenvs in `let'.
For `lambda' use the outer `fvrs' when building the closure and don't
forget to remove `vars' from the `emvrs' and `lmenvs' of the body.
* lisp/emacs-lisp/cl-macs.el (cl-byte-compile-block): Disable optimization
in lexbind, because it needs a different implementation.
* src/bytecode.c (exec_byte_code): Fix handling of &rest.
* src/eval.c (Vinternal_interpreter_environment): Remove.
(syms_of_eval): Do declare Vinternal_interpreter_environment as
a global lisp var, but unintern it to hide it.
(Fcommandp):
* src/data.c (Finteractive_form): Understand `closure's.