1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-12 09:28:24 +00:00
Commit Graph

1350 Commits

Author SHA1 Message Date
Martin Rudalics
9397e56f74 Move/add window-buffer-related functions to window.el.
* 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.
2011-06-11 11:50:37 +02:00
Glenn Morris
f0da764a5c Allow/recommend explicit args for minor-modes in file local eval:s.
* lisp/files.el (hack-one-local-variable-eval-safep):
Allow minor-modes with explicit +/-1 arguments.

* doc/emacs/custom.texi (Specifying File Variables):
Recommend explicit arguments for minor modes.

* etc/NEWS: Likewise.

* lisp/doc-view.el, lisp/net/soap-client.el: Update file locals.
2011-06-09 16:22:06 -04:00
Alexander Klimov
254c37a51d Small fixes for dired-listing-switches usage.
Ref: http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg01000.html

* lisp/mail/sendmail.el (mail-recover-1, mail-recover):
* lisp/files.el (recover-file, recover-session):
Handle dired-listing-switches not being just a single short option.
2011-06-08 22:33:26 -07:00
Chong Yidong
5d344e883f Tweak auto-mode-alist to handle config.h.in (Bug#8547).
* lisp/files.el (auto-mode-alist): Move config rule after the
in-stripping one.
2011-05-28 15:26:25 -04:00
David Michael
7a6b1aef76 * lisp/files.el (interpreter-mode-alist): Add rbash.
Fixes: debbugs:8745
2011-05-27 16:33:48 -03:00
Glenn Morris
e145f1881a Make set-auto-mode respect mode: entries at the end of the file (bug#8586)
* 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.
2011-05-26 21:00:53 -04:00
Glenn Morris
27b48e635a * lisp/files.el (hack-local-variables, hack-local-variables-apply): Doc fixes. 2011-05-26 00:35:47 -07:00
Glenn Morris
98f593b8d4 Downcase mode names in recent files.el changes.
* lisp/files.el (hack-local-variables-prop-line, hack-local-variables):
Downcase mode names, as seems to be traditional.
2011-05-26 00:23:11 -07:00
Stefan Monnier
4f91a8160f Don't quote lambda expressions with `quote'. 2011-05-23 14:57:17 -03:00
Glenn Morris
162d78a17e Further tweak previous files.el change.
* lisp/files.el (hack-local-variables): In the MODE-ONLY case, try to
ignore minor modes.
2011-05-21 18:18:49 -07:00
Glenn Morris
80614e5701 Tweak previous files.el change.
* lisp/files.el (hack-local-variables-prop-line)
(hack-local-variables): In the MODE-ONLY case, return the full mode
symbol, including "-mode".
2011-05-21 17:34:41 -07:00
Glenn Morris
88dfa7568a More small hack-local-variables tweaks for MODE-ONLY case.
* 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'.
2011-05-21 17:04:49 -07:00
Glenn Morris
7e4ccca345 Small files.el hack-local changes for mode-only case.
* lisp/files.el (hack-local-variables-prop-line, hack-local-variables):
If only interested in the mode, don't bother doing the other stuff.
2011-05-21 15:33:12 -07:00
Nix
35fd0881e6 Small break-hardlink-on-save fix.
* files.el (basic-save-buffer-2):
Fix handling of break-hardlink-on-save with non-existent files.
2011-05-19 17:51:46 -07:00
Glenn Morris
b8f82dc15f Deprecate using "mode:" to enable minor modes (bug#8613)
* 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:".
2011-05-09 19:31:42 -07:00
Chong Yidong
c8d173eb1e * files.el (auto-mode-alist): Use js-mode for .json (Bug#8529). 2011-04-23 20:24:30 -04:00
Juanma Barranquero
06b605171f lisp/*.el: Lexical-binding cleanup. 2011-04-19 15:44:55 +02:00
Eli Zaretskii
04f33f1ed9 Produce more accurate results from file-size-human-readable.
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.
2011-04-09 09:59:26 +03:00
Eli Zaretskii
e3971c4440 New function file-size-human-readable.
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'.
2011-04-08 18:31:33 +03:00
Chong Yidong
7d668f2c18 Reimplement list-processes in Lisp.
* 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.
2011-04-06 17:13:17 -04:00
Juanma Barranquero
3e214b503e New variable `revert-buffer-in-progress-p'.
* 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'.
2011-04-06 21:38:46 +02:00
Glenn Morris
afa8e9f606 * lisp/files.el (save-some-buffers): Doc fix. 2011-04-02 11:12:21 -07:00
Stefan Monnier
cafdcef32d Merge from trunk 2011-03-21 12:42:16 -04:00
Glenn Morris
09d9db2c49 Merge from emacs-23; up to 2010-06-03T22:16:02Z!dann@ics.uci.edu 2011-03-12 11:19:47 -08:00
Eli Zaretskii
2920e68d73 Fix comparisons of file ownership on MS-Windows for the Administrator user.
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.
2011-03-11 14:19:08 +02:00
Stefan Monnier
0d6459dfb5 Merge from trunk 2011-03-06 16:22:16 -05:00
Antoine Levitt
7e27ce9cdb Replace many instances of read-file-name with read-directory-name.
* lisp/files.el (delete-directory, copy-directory, list-directory): Use
read-directory-name.

* lisp/find-file.el (ff-find-the-other-file):
* lisp/net/ange-ftp.el (ange-ftp-make-directory):
* lisp/printing.el (pr-interactive-dir):
* lisp/progmodes/ada-prj.el (ada-prj-load-directory):
* lisp/progmodes/ebnf2ps.el (ebnf-print-directory)
(ebnf-spool-directory, ebnf-eps-directory)
(ebnf-syntax-directory):
* lisp/shell.el (shell):
* lisp/speedbar.el (speedbar-create-directory):
* lisp/vc/emerge.el (emerge-merge-directories):
* lisp/vc/vc-dir.el (vc-dir):
* lisp/vc/vc.el (vc-create-tag, vc-retrieve-tag): Likewise.

* lisp/gnus.el (gnus-interactive): Use read-directory-name.

* lisp/gnus-uu.el (gnus-uu-decode-uu-and-save)
(gnus-uu-decode-unshar-and-save, gnus-uu-decode-save)
(gnus-uu-decode-binhex, gnus-uu-decode-yenc)
(gnus-uu-decode-save-view, gnus-uu-decode-postscript-and-save):
Likewise.

* lisp/mh-funcs.el (mh-store-msg, mh-store-buffer):
* lisp/mh-mime.el (mh-mime-save-parts): Use read-directory-name.

* lisp/dired.el: Clarify comment.
2011-03-05 16:56:00 -05:00
Reuben Thomas
2de9cc1acd Handle git-style backup names in file-name-version-regexp (Bug#8159).
* files.el (file-name-version-regexp): Handle backup files of the
form `foo.js.~HEAD~1~' (Bug#8159).
2011-03-05 15:35:08 -05:00
David Engster
c5f09daf79 Make save-some-buffers message more informative (Bug#8134).
* files.el (save-some-buffers): Report the names of buffers saved
automatically due to buffer-save-without-query.
2011-03-05 14:37:46 -05:00
Eli Zaretskii
3ae59fff62 Fix bug #8177 with re-visiting image files.
files.el (find-file-noselect): Don't ask about re-visiting
 non-literally if the file is already visited in image-mode.
2011-03-05 10:48:52 +02:00
Glenn Morris
06083aa12d file-truename doc fix for bug#2341.
* lisp/files.el (file-truename): Doc fix.

* doc/lispref/files.texi (Truenames): Minor clarification.
2011-03-03 00:10:52 -08:00
Glenn Morris
0e0b298905 * lisp/files: Fix comment typo. 2011-02-28 20:26:38 -08:00
Glenn Morris
82137b5135 * lisp/files.el: Comment. 2011-02-28 19:43:14 -08:00
Glenn Morris
6640b281f3 Add the ability to exclude dir-locals from subdirs. (Bug#8100)
* 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.
2011-02-28 19:05:28 -08:00
Glenn Morris
07915ed93c More dir-locals fixes for files.el.
* 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.
2011-02-24 00:02:45 -08:00
Glenn Morris
ebe401f697 Partial fix for bug#8095.
* 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.)
2011-02-23 23:47:06 -08:00
Glenn Morris
5582c6706a * lisp/files.el (safe-local-eval-forms): Add the write-file-hooks version.
This obsolete form is still supported, and present in some of the
files synced from gnulib, for example.
2011-02-22 19:24:23 -08:00
Stefan Monnier
f619ad4ca2 Merge from trunk 2011-02-21 17:34:51 -05:00
Glenn Morris
67ab0163d6 Merge from emacs-23; up to 2010-06-01T01:49:15Z!monnier@iro.umontreal.ca 2011-02-19 11:40:59 -08:00
Stefan Monnier
aa56f3613e * lisp/files.el (cd): Make completion obey cd-path.
* 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
2011-02-18 12:18:16 -05:00
Glenn Morris
72d6685c11 * lisp/files.el (find-file-literally): Doc fix. 2011-02-17 21:15:22 -08:00
Stefan Monnier
b38b1ec071 Various compiler bug-fixes. MPC seems to run correctly now.
* 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.
2011-02-17 16:19:13 -05:00
Chong Yidong
20fac86e2e * lisp/files.el (copy-directory): Revert to pre-2011-01-29 version. 2011-02-12 14:43:04 -05:00
Thierry Volpiatto
470d996db4 New optional arg COPY-CONTENTS to copy-directory.
* files.el (copy-directory): New argument COPY-CONTENTS for
copying directory contents into another existing directory.
2011-02-12 14:34:50 -05:00
Bastien Guerry
75d1d833f5 Save unmodified buffers when buffer-file-name doesn't exist.
* files.el (basic-save-buffer): save unmodified buffers when
the file pointed by buffer-file-name doesn't exist.
2011-02-11 18:35:37 +01:00
Chong Yidong
65821e2244 * lisp/files.el (copy-directory): New arg COPY-AS-SUBDIR.
If nil, don't copy as a subdirectory.
2011-02-05 23:59:06 -05:00
Sam Steingold
e8e4d5c88e undo 2011-02-01T18:15:18Z!sds@gnu.org (purecopy-cons, purecopy-car) at Stefan Monnier's request 2011-02-01 16:37:12 -05:00
Sam Steingold
0b75349e7e * lisp/subr.el (purecopy-cons, purecopy-car): Add shortcuts.
* lisp/faces.el (face-x-resources): Use `purecopy-cons'.
* lisp/files.el (auto-mode-alist, interpreter-mode-alist): Use
`purecopy-car'.
* lisp/international/fontset.el (font-encoding-alist): Ditto.
* lisp/international/mule-conf.el (file-coding-system-alist): Ditto.
* lisp/international/mule.el (auto-coding-alist)
(auto-coding-regexp-alist): Ditto.
* lisp/mouse.el (mouse-buffer-menu-mode-groups): Use `purecopy-cons'.
* lisp/term/x-win.el (x-gtk-stock-map): Ditto.
2011-02-01 13:15:18 -05:00
Chong Yidong
14beddf471 Merge changes from emacs-23 branch 2011-01-31 18:54:50 -05:00
Chong Yidong
6fa1f65165 * lisp/files.el (copy-directory): Fix arguments to the recursive call. 2011-01-31 12:03:37 -05:00