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

1657 Commits

Author SHA1 Message Date
Glenn Morris
30213927b6 Use with-demoted-errors now that it can format any error messages
* dframe.el (dframe-timer-fn):
* files.el (dir-locals-read-from-file):
* mpc.el (mpc--status-timer-run, mpc--status-idle-timer-run, mpc-format):
* reveal.el (reveal-post-command):
* saveplace.el (load-save-place-alist-from-file):
* shell.el (shell-resync-dirs):
* w32-common-fns.el (x-get-selection-value):
* emacs-lisp/copyright.el (copyright-find-copyright):
* emacs-lisp/eldoc.el (eldoc-print-current-symbol-info):
* emulation/tpu-edt.el (tpu-copy-keyfile):
* play/bubbles.el (bubbles--mark-neighbourhood):
* progmodes/executable.el (executable-make-buffer-file-executable-if-script-p):
* term/pc-win.el (x-get-selection-value): Use with-demoted-errors.
2013-09-11 22:32:57 -07:00
Stefan Monnier
feeff482d8 * lisp/files.el (set-auto-mode): Simplify a bit further. 2013-09-11 08:36:59 -04:00
Glenn Morris
2a08047aed Improve previous interpreter-mode-alist change
* lisp/files.el (interpreter-mode-alist): Remove \\` \\' parts.
(set-auto-mode): Don't regexp-quote elements.

* lisp/progmodes/python.el (interpreter-mode-alist): Remove \\` \\'.

* lisp/progmodes/cc-mode.el (interpreter-mode-alist):
* lisp/progmodes/ruby-mode.el (interpreter-mode-alist):
Revert previous change.

* etc/NEWS: Update.
2013-09-10 23:44:35 -07:00
Glenn Morris
1af4c2203c Treat interpreter-mode-alist as alist of regexps, not literals
Cf http://lists.gnu.org/archive/html/emacs-devel/2005-08/msg00472.html

* lisp/files.el (interpreter-mode-alist): Convert to regexps.
(set-auto-mode): Adapt for this. 

* lisp/progmodes/cperl-mode.el (cperl-clobber-mode-lists):
Comment out unused variable.

* lisp/progmodes/cc-mode.el (interpreter-mode-alist):
* lisp/progmodes/python.el (interpreter-mode-alist):
* lisp/progmodes/ruby-mode.el (interpreter-mode-alist): Convert to regexps.

* lisp/progmodes/sh-script.el (sh-set-shell):
No longer use interpreter-mode-alist to get list of shells.

* etc/NEWS: Mention this.

Fixes: debbugs:15306
2013-09-10 16:38:52 -04:00
Glenn Morris
2d85dc347c * lisp/files.el (auto-mode-alist): Use sh-mode for .bash_history. 2013-08-23 14:58:41 -04:00
Glenn Morris
bb35f42f61 * lisp/files.el (create-file-buffer): Rework previous change. 2013-08-23 13:34:09 -04:00
Glenn Morris
cb8d261243 * lisp/files.el (interpreter-mode-alist): Use tcl-mode for expect scripts. 2013-08-23 13:09:09 -04:00
Glenn Morris
61611d54b5 * files.el (create-file-buffer): Handle a file whose basename is all spaces.
Fixes: debbugs:15162
2013-08-23 13:08:19 -04:00
Dmitry Antipov
ed4fd9c527 * lisp/files.el (cache-long-line-scans): Make
obsolete alias to `cache-long-scans'.
* etc/NEWS: Mention `cache-long-scans'.
2013-08-06 20:33:14 +04:00
Stefan Monnier
76dc5996b4 * lisp/files.el: Use lexical-binding.
(dir-locals-read-from-file): Remove unused `err' variable.
(hack-dir-local-variables--warned-coding): New var.
(hack-dir-local-variables): Use it to avoid repeated warnings.
(make-backup-file-name--default-function): New function.
(make-backup-file-name-function): Use it as default.
(buffer-stale--default-function): New function.
(buffer-stale-function): Use it as default.
(revert-buffer-insert-file-contents--default-function): New function.
(revert-buffer-insert-file-contents-function): Use it as default.
(insert-directory): Avoid add-to-list.
* lisp/autorevert.el (auto-revert-handler): Simplify.
Use buffer-stale--default-function.
2013-08-01 19:18:37 -04:00
Dmitry Antipov
3b734d1c00 * lisp/emacs-lisp/re-builder.el (reb-color-display-p):
* lisp/files.el (save-buffers-kill-terminal):
* lisp/net/browse-url.el (browse-url):
* lisp/server.el (server-save-buffers-kill-terminal):
* lisp/textmodes/reftex-toc.el (reftex-toc, reftex-toc-revert):
Prefer nil to selected-frame for the first arg of frame-parameter.
2013-07-31 10:52:26 +04:00
Stefan Monnier
ac93e56b69 * lisp/files.el (revert-buffer-function): Use a non-nil default.
(revert-buffer-preserve-modes): Declare var to
provide access to the `preserve-modes' argument.
(revert-buffer): Let-bind it.
(revert-buffer--default): New function, extracted from revert-buffer.
2013-07-24 00:56:12 -04:00
Glenn Morris
17bd3d0493 Adding :safe property to a defcustom does not merit a :version bump 2013-07-11 09:07:00 -07:00
Paul Eggert
954b166e90 Timestamp fixes for undo.
* doc/lispref/text.texi (Undo):
Document (t . 0) and (t . -1) in buffer-undo-list.
* etc/NEWS: Changes to visited-file-modtime, set-visited-file-modtime.
* lisp/files.el (clear-visited-file-modtime): Move here from fileio.c.
* src/atimer.c (schedule_atimer):
* src/fileio.c (Ffile_newer_than_file_p):
Minor cleanup: use EMACS_TIME_LT so that we can remove EMACS_TIME_GT.
* src/buffer.c (buffer-undo-list): Document (t . 0) and (t . -1).
* src/fileio.c (Fclear_visited_file_modtime): Move to lisp/files.el.
(syms_of_fileio): Remove Sclear_visited_file_name.
(Fvisited_file_modtime): Return -1, not (-1 ...), when the visited
file doesn't exist; this avoids an ambiguity with negative timestamps.
(Fset_visited_file_modtime): Accept -1 and 0 as time-list arg.
* src/systime.h (make_emacs_time, invalid_emacs_time):
Don't assume struct timespec layout; POSIX doesn't guarantee it.
(EMACS_TIME_NE, EMACS_TIME_GT, EMACS_TIME_GE): Remove.
* src/undo.c (record_first_change): Push (visited-file-modtime) onto
undo list rather than reimplementing it by hand, incorrectly.

Fixes: debbugs:14824
2013-07-09 23:26:23 -07:00
Leo Liu
56973319b5 * files.el (require-final-newline): Allow safe local value.
Fixes: debbugs:14834
2013-07-10 11:10:27 +08:00
Jan Djärv
1afb1d0715 * lisp/files.el (write-file): Do not display confirm dialog for NS,
it does its own dialog, which can't be cancelled.

* src/nsfns.m: Remove panelOK.
(ns_fd_data): New.
(ns_run_file_dialog): New function.
(Fns_read_file_name): Fill in ns_fd_data, post an event and start the
event loop, so file dialog is popped up by ns_run_file_dialog, called
by sendEvent (Bug#14578).
(EmacsSavePanel, EmacsOpenPanel): Remove ok and cancel methods.

* src/nsterm.h (NSSavePanel): Update comment.
(NSAPP_DATA2_RUNFILEDIALOG): Define.
(ns_run_file_dialog): Declare.

* src/nsterm.m (sendEvent:): Handle NSAPP_DATA2_RUNFILEDIALOG.
2013-07-06 19:58:41 +02:00
Michal Nazarewicz
ef099a941f Add `remember-notes' function to store random notes across Emacs
restarts.
* remember.el (remember-data-file): Add :set callback to affect
notes buffer (if any).
(remember-notes): New command.
(remember-notes-buffer-name, bury-remember-notes-on-kill):
New defcustoms for the `remember-notes' function.
(remember-notes-save-and-bury-buffer): New command.
(remember-notes-mode-map): New variable.
(remember-mode): New minor mode.
(remember-notes--kill-buffer-query): New function.
* lisp/startup.el (initial-buffer-choice): Add notes to custom type.
* src/buffer.c (FKill_buffer): Run `kill-buffer-query-functions'
before checking whether buffer is modified.  This lets
`kill-buffer-query-functions' cancel killing of the buffer or save
its content before `kill-buffer' asks user the "Buffer %s
modified; kill anyway?" question.

* remember.el (remember-append-to-file):
Don't mix `find-buffer-visiting' and `get-file-buffer'.

* lisp/files.el (find-file-noselect): Simplify conditional expression.
2013-06-30 18:29:23 -04:00
Glenn Morris
f440830d60 Silence some compiler warnings
* calculator.el (electric, ehelp): No need to load when compiling.
(Electric-command-loop, electric-describe-mode): Declare.

* doc-view.el (doc-view-current-converter-processes): Move before use.

* files.el (dired-unmark):
* progmodes/gud.el (gdb-input): Update declarations.

* emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Move MODE-set-explicitly definition before use.

* erc/erc-log.el (erc-network-name): Declare.

* erc/erc-notify.el (pcomplete--here): Declare.
(pcomplete/erc-mode/NOTIFY): Require pcomplete.

* international/mule-diag.el (mule-diag):
Don't use obsolete window-system-version.

* mail/feedmail.el (smtpmail): No need to load when compiling.
(smtpmail-via-smtp, smtpmail-smtp-server): Declare.

* mail/mail-utils.el (rfc822): No need to load when compiling.
(rfc822-addresses): Autoload it.
(mail-strip-quoted-names): Trivial simplification.

* mail/rmail.el (rmail-mime-message-p, rmail-mime-toggle-raw): Declare.
(rmail-retry-failure): Don't assume that rmail-mime-feature == rmailmm.

* net/snmp-mode.el (tempo): Don't duplicate requires.

* progmodes/prolog.el (info): No need to load when compiling.
(comint): Require before shell requires it.
(Info-goto-node): Autoload it.
(Info-follow-nearest-node): Declare.
(prolog-help-info, prolog-goto-predicate-info): No need to require info.

* textmodes/artist.el (picture-mode-exit): Declare.

* textmodes/reftex-parse.el (reftex-parse-from-file):
Trivial rewrite so the compiler can parse it better.

* url/url-dav.el (url-http): Require it.
(url-http-head-file-attributes): Don't autoload it.

* url/url-proxy.el (url-http): Autoload it.
2013-05-21 00:25:14 -07:00
Leo Liu
b7260dd49c * files.el (basic-save-buffer): Don't let errors in
before-save-hook prevent saving buffer.

* progmodes/octave.el (octave-function-file-p)
(octave-skip-comment-forward, octave-function-file-comment)
(octave-update-function-file-comment): New functions.
(octave-mode-map): Bind C-c ; to
octave-update-function-file-comment.
(octave-mode-menu): Add octave-update-function-file-comment.
(octave-mode, inferior-octave-mode): Fix doc-string.
(octave-insert-defun): Conform to Octave's coding convention.

Fixes: debbugs:14285
2013-04-28 01:07:01 +08:00
Tassilo Horn
fc7f4d7e6a * files.el (auto-mode-alist): Delete OpenDocument and StarOffice
file extensions from the archive-mode entry in order to prefer
doc-view-mode-maybe with archive-mode as fallback (bug#14188).
2013-04-18 08:24:10 +02:00
Paul Eggert
54ac5d4745 Spelling fixes. 2013-04-14 14:57:21 -07:00
Stefan Monnier
91e8293cc5 * lisp/files.el (normal-mode): Only use default major-mode if no other mode
was specified.

Fixes: debbugs:14089
2013-04-13 22:55:21 -04:00
Stefan Monnier
a829b0dc89 * lisp/files.el: Allow : in local variables.
(hack-local-variable-regexp): New var.
(hack-local-variables-prop-line, hack-local-variables): Use it.

Fixes: debbugs:14089
2013-04-13 20:59:48 -04:00
Eli Zaretskii
33bb237a73 Fix the non-creation of backup files in temporary-file directory on Windows.
lisp/files.el (normal-backup-enable-predicate): On MS-Windows and
 MS-DOS compare truenames of temporary-file-directory and of the
 file, so that 8+3 aliases (usually found in $TEMP on Windows)
 don't fail comparison by compare-strings.  Also, compare file
 names case-insensitively on MS-Windows and MS-DOS.
2013-04-06 10:41:09 +03:00
Leo Liu
7b0e2f853f * lisp/files.el (kill-buffer-hook): Doc fix.
* lisp/emacs-lisp/edebug.el (edebug-mode): Make sure edebug-kill-buffer
is the last entry in kill-buffer-hook.

* lisp/nxml/rng-valid.el (rng-validate-while-idle)
(rng-validate-quick-while-idle): Guard against deleted buffer.

Fixes: debbugs:13999
2013-03-24 14:42:25 +08:00
Glenn Morris
cb05411f52 * files.el (inhibit-local-variables-regexps): Add .diff and .patch.
Fixes: debbugs:13862
2013-03-03 23:37:30 -08:00
Stefan Monnier
944c37effa * lisp/files.el (basic-save-buffer): Remove redundant directory-creation. 2013-02-25 09:29:41 -05:00
Glenn Morris
b367ec7bc1 * lisp/files.el (basic-save-buffer): Move check for existing parent directory
after hooks.  (Bug#13773)
2013-02-20 21:44:06 -05:00
Glenn Morris
0b24433565 * files.el (basic-save-buffer): Offer to create a non-existing directory.
Fixes: debbugs:3016
2013-02-12 00:36:09 -08:00
Glenn Morris
97a1cd9d27 Add `enable-dir-local-variables'
* lisp/files.el (enable-dir-local-variables): New variable.
(hack-dir-local-variables): Respect enable-dir-local-variables.

* lisp/tutorial.el (help-with-tutorial): Ignore directory-local variables.

Fixes: debbugs:11127
2013-02-10 17:50:45 -08:00
Chong Yidong
0ccdf61ed6 * files.el (basic-save-buffer-1): Don't set buffer-file-coding-system-explicit.
Fixes: debbugs:4533
2013-02-10 11:08:21 +08:00
Eli Zaretskii
8549f9e89b Remove all references to buffer-file-type and related features.
src/xdisp.c (decode_mode_spec): Remove handling of %t.

 lisp/net/ange-ftp.el (ange-ftp-insert-file-contents): Don't reference
 buffer-file-type.
 lisp/mail/feedmail.el (feedmail-force-binary-write): Doc fix.
 (feedmail-run-the-queue, feedmail-dump-message-to-queue)
 (feedmail-send-it-immediately): Don't bind buffer-file-type, bind
 coding-system-for-write instead.
 lisp/jka-compr.el (jka-compr-write-region): Don't bind
 buffer-file-type.
 lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't bind
 buffer-file-type.
 lisp/files.el (file-name-buffer-file-type-alist): Remove defvar.
 (insert-file-contents-literally): Remove reference to
 file-name-buffer-file-type-alist.
 lisp/dos-w32.el (file-name-buffer-file-type-alist): Deprecate and
 make-obsolete.
 (find-buffer-file-type-match, find-buffer-file-type): Remove.
 (find-buffer-file-type-coding-system): Remove references to
 find-buffer-file-type-match, find-buffer-file-type, and
 buffer-file-type.
 Don't put find-buffer-file-type-coding-system into
 file-coding-system-alist.
 (find-file-binary, find-file-text): Bind coding-system-for-read
 instead of file-name-buffer-file-type-alist.
 lisp/erc/erc-dcc.el (erc-dcc-get-file): Don't reference buffer-file-type.

 doc/emacs/msdog.texi (Text and Binary): Delete the description of
 file-name-buffer-file-type-alist.

 doc/lispref/modes.texi (%-Constructs): Remove the description of %t.
 doc/lispref/nonascii.texi (MS-DOS File Types): Delete node.

Fixes: debbugs:12989
2013-02-09 14:52:01 +02:00
Glenn Morris
9dbda10075 Reduce delay between backing up a file and saving new version
* lisp/files.el (basic-save-buffer-2):
Choose coding system for writing the file before backing it up.

* src/fileio.c (choose_write_coding_system): Make it callable from Lisp.
(Fwrite_region): If coding-system-for-write is set, don't call
choose_write_coding_system.
Move the last piece of choose_write_coding_system here.
(syms_of_fileio): Add choose-write-coding-system.

Fixes: debbugs:13522
2013-01-30 22:35:45 -08:00
Elias Pipping
72781fefa6 * lisp/files.el (auto-mode-alist): Use doc-view for djvu files.
* lisp/doc-view.el (doc-view-document->bitmap):
Use doc-view-single-page-converter-function instead of
single-page-converter arg; adjust callers.

Fixes: debbugs:13164
2013-01-10 10:50:04 -05:00
Stefan Monnier
4a74c81880 * lisp/view.el (view--enable, view--disable): Rename from view-mode-enable
and view-mode-disable and assume it's called from view-mode.
(view-mode-enable, view-mode-disable): Redefine as obsolete
compatibility layer above view-mode.
(view-mode-enter): Call `view-mode'.
* lisp/files.el (after-find-file): Call `view-mode'.
2013-01-03 21:53:48 -05:00
Paul Eggert
0877d0dc24 Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca 2013-01-02 08:13:04 -08:00
Paul Eggert
ab422c4d68 Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
Glenn Morris
4cddca3070 * files.el (parse-colon-path): Return nil for empty path elements.
Fixes: debbugs:13296
2012-12-31 13:20:07 -08:00
Eli Zaretskii
7e56b10316 Fix last commit.
lisp/files.el (basic-save-buffer): If set-file-extended-attributes
 fails, fall back on set-file-modes.

Fixes: debbugs:13298
2012-12-29 16:58:41 +02:00
Eli Zaretskii
ccad023bc3 Fix bug #13298 with failed backups by falling back on set-file-modes.
src/fileio.c (Fset_file_selinux_context, Fset_file_acl): Return t if
 file's SELinux context or ACLs successfully set, nil otherwise.

 lisp/files.el (backup-buffer-copy, basic-save-buffer-2): If
 set-file-extended-attributes fails, fall back on set-file-modes
 instead of signaling an error.

 doc/lispref/files.texi (Changing Files): Document the return values of
 set-file-selinux-context and set-file-acl.
2012-12-29 16:32:36 +02:00
Kevin Ryde
191562422a * lisp/files.el (auto-save-file-name-p): Use \` and \'.
Fixes: debbugs:13186
2012-12-17 10:51:49 -05:00
Romain Francoise
7c3d167f48 Add support for preserving ACL entries of files.
* configure.ac (acl): New option.
	(HAVE_POSIX_ACL): Test for POSIX ACL support.  This is typically
	provided by libacl on GNU/Linux.

	* fileio.c (Ffile_acl, Fset_file_acl): New functions.
	(Fcopy_file): Change last arg to `preserve_extended_attributes'
	and copy ACL entries of file in addition to SELinux context if
	set.
	(syms_of_fileio): Add `file-acl' and `set-file-acl'.

	* Makefile.in (LIBACL_LIBS): New macro.
	(LIBES): Use it.

	* files.el (file-extended-attributes)
	(set-file-extended-attributes): New functions.
	(backup-buffer): Use them to handle both SELinux context and ACL
	entries.
	(backup-buffer-copy): Work with an alist of extended attributes,
	rather than an SELinux context.
	(basic-save-buffer-2): Ditto.

	* files.texi (File Attributes): Document ACL support and new
	`file-acl' function.
	(Changing Files): Mention argument name change of `copy-file' and
	document new function `set-file-acl'.
2012-12-16 19:22:27 +01:00
Paul Eggert
97976f9f3f Fix permissions bugs with setgid directories etc.
* configure.ac (BSD4_2): Remove; no longer needed.
* admin/CPP-DEFINES (BSD4_2): Remove.
* doc/lispintro/emacs-lisp-intro.texi (Files List):
directory-files-and-attributes now outputs t for attribute that's
now a placeholder.
* doc/lispref/files.texi (Testing Accessibility): Document GROUP arg
of file-ownership-preserved-p.
(File Attributes): Document that 9th element is now
just a placeholder.
* doc/lispref/os.texi (User Identification): Document new functions group-gid,
group-real-gid.
* etc/NEWS: Document changes to file-attributes,
file-ownership-preserved-p.
Mention new functions group-gid, group-real-gid.
* lisp/files.el (backup-buffer): Don't rely on 9th output of
file-attributes, as it's now a placeholder.  Instead, use the new
optional arg of file-ownership-preserved-p.
(file-ownership-preserved-p): New optional arg GROUP.
Fix mishandling of setuid directories that would cause this
function to return t when it should have returned nil.
Document what happens if the file does not exist, and when
it's not known whether the ownership will be preserved.
* lisp/net/tramp-sh.el (tramp-sh-handle-file-ownership-preserved-p):
Likewise.
(tramp-get-local-gid): Use group-gid for integer, as that's
faster and more reliable.
* src/dired.c (Ffile_attributes): Return t as the 9th attribute,
to mark it as a placeholder.  The old value was often wrong.
The only user of this attribute has been changed to use
file-ownership-preserved-p instead, with its new group arg.
* src/editfns.c (Fgroup_gid, Fgroup_real_gid): New functions.

Fixes: debbugs:13125
2012-12-14 10:59:00 -08:00
Glenn Morris
c5bc2d1d05 Merge from emacs-24; up to 2012-11-23T06:23:28Z!cyd@gnu.org 2012-12-02 17:08:31 -08:00
Leo Liu
ff3d86d099 * lisp/files.el (dir-locals-read-from-file): Check file non-empty
before reading.

Fixes: debbugs:13038
2012-12-01 23:45:38 +08:00
Chong Yidong
5781e949ae Improve the descriptive message in `recover-session'.
* lisp/files.el (recover-session): Improve the descriptive message,
and use substitute-command-keys.
2012-12-01 10:09:45 +08:00
Glenn Morris
824eefe427 Warn if try to set coding in dir-locals (bug#7169)
* lisp/files.el (hack-dir-local-variables):
Warn if try to set coding via dir-locals, since it doesn't work.
2012-11-29 14:28:39 -05:00
Glenn Morris
e9df8f871d By default, ignore case when testing inhibit-local-variables (bug#10610)
* lisp/files.el (inhibit-local-variables-ignore-case): New.
(inhibit-local-variables-p): Use inhibit-local-variables-ignore-case.
Doc fix.
(inhibit-local-variables-regexps, inhibit-local-variables-suffixes):
Doc fixes.
2012-11-28 20:13:33 -05:00
Glenn Morris
6ef2e5ef52 Merge from emacs-24; up to 2012-11-17T22:12:47Z!eggert@cs.ucla.edu 2012-11-20 20:47:55 -08:00
Stefan Monnier
ac5392dcfd * lisp/files.el (load-file): Require match in minibuffer selection, as was
the case in Emacs-20 before we changed the spec to allow .elc files.

Fixes: debbugs:12935
2012-11-19 13:27:25 -05:00
Paul Eggert
0c93aa38b3 Minor cleanup for times as lists of four integers.
* doc/lispref/os.texi (Time Parsing): Time values can now be four integers.
* lisp/files.el (dir-locals-directory-cache):
* lisp/ps-bdf.el (bdf-file-mod-time, bdf-read-font-info):
Doc fixes.
* lisp/net/tramp-sh.el (tramp-do-file-attributes-with-ls):
* lisp/ps-bdf.el (bdf-file-newer-than-time):
Process four-integers time stamps, not two.  Doc fixes.
2012-11-17 18:13:19 -08:00
Stefan Monnier
d41706aa7a * lisp/files.el (hack-one-local-variable--obsolete): New function.
(hack-one-local-variable): Use it for obsolete settings.
2012-11-08 14:50:08 -05:00
Stefan Monnier
e07fcbdc32 * lisp/files.el (find-alternate-file): Only ask one question.
Fixes: debbugs:12487
2012-10-29 09:28:41 -04:00
Chong Yidong
9414dd8d50 Move bovine-grammar and wisent-grammar into lisp/ directory.
* lisp/files.el (auto-mode-alist): Add .by and .wy (Semantic grammars).

* cedet/semantic/bovine/grammar.el:
* cedet/semantic/wisent/grammar.el: Move from admin/grammars.  Add
autoloads for bovine-grammar-mode and wisent-grammar-mode.
2012-10-06 22:18:35 +08:00
Glenn Morris
e8757f091a Merge from emacs-24; up to 2012-05-08T14:11:47Z!monnier@iro.umontreal.ca 2012-10-05 00:38:05 -07:00
Glenn Morris
677c110942 Doc typo fixes 2012-10-04 23:50:23 -07:00
Paul Eggert
86ec63ba30 Revert the FOLLOW-SYMLINKS change for file-attributes. 2012-09-30 19:07:14 -07:00
Paul Eggert
e7a2937b11 file-attributes has a new optional arg FOLLOW-SYMLINKS.
* doc/lispref/files.texi (File Attributes): Describe it.
(Magic File Names): Use it.
* etc/NEWS: Document the change.
* lisp/files.el (remote-file-name-inhibit-cache):
* lisp/time.el (display-time-file-nonempty-p): Use it.
* lisp/files.el (after-find-file): Don't chase links before calling
file-exists-p, as file-exists-p already does the right thing.
* src/dired.c (directory_files_internal, Ffile_attributes):
New arg follow_symlinks.  All uses changed.
2012-09-30 14:12:04 -07:00
Chong Yidong
59f7af816e Use declare forms, where possible, to mark obsolete functions.
* lisp/allout.el (allout-passphrase-hint-string): Likewise.
(allout-init): Use a declare form to mark obsolete.

* lisp/calendar/calendar.el (calendar-version):
* lisp/calendar/icalendar.el (icalendar-extract-ical-from-buffer)
(icalendar-convert-diary-to-ical):
* lisp/cus-edit.el (custom-mode):
* lisp/ansi-color.el (ansi-color-unfontify-region):
* lisp/international/latin1-disp.el (latin1-char-displayable-p):
* lisp/progmodes/cwarn.el (turn-on-cwarn-mode):
* lisp/progmodes/which-func.el (which-func-update-1): Use
define-obsolete-function-alias.

* lisp/bookmark.el (bookmark-jump-noselect): Use a declare form to mark
this function obsolete.

* lisp/calendar/cal-x.el (calendar-two-frame-setup)
(calendar-only-one-frame-setup, calendar-one-frame-setup):
* lisp/calendar/calendar.el (american-calendar, european-calendar)
(calendar-for-loop):
* lisp/comint.el (comint-dynamic-simple-complete)
(comint-dynamic-complete-as-filename, comint-unquote-filename):
* lisp/desktop.el (desktop-load-default):
* lisp/dired-x.el (dired-omit-here-always)
(dired-hack-local-variables, dired-default-directory):
* lisp/emacs-lisp/derived.el (derived-mode-class):
* lisp/emacs-lisp/timer.el (timer-set-time-with-usecs):
* lisp/emacs-lock.el (toggle-emacs-lock):
* lisp/epa.el (epa-display-verify-result):
* lisp/epg.el (epg-sign-keys, epg-start-sign-keys)
(epg-passphrase-callback-function):
* lisp/eshell/esh-util.el (eshell-for):
* lisp/eshell/eshell.el (eshell-remove-from-window-buffer-names)
(eshell-add-to-window-buffer-names):
* lisp/files.el (locate-file-completion):
* lisp/imenu.el (imenu-example--create-c-index)
(imenu-example--create-lisp-index)
(imenu-example--lisp-extract-index-name)
(imenu-example--name-and-position):
* lisp/international/mule-cmds.el (princ-list):
* lisp/international/mule-diag.el (decode-codepage-char):
* lisp/international/mule-util.el (detect-coding-with-priority):
* lisp/iswitchb.el (iswitchb-read-buffer):
* lisp/mail/mailalias.el (mail-complete):
* lisp/mail/sendmail.el (mail-sent-via):
* lisp/mouse.el (mouse-popup-menubar-stuff, mouse-popup-menubar)
(mouse-major-mode-menu):
* lisp/password-cache.el (password-read-and-add):
* lisp/pcomplete.el (pcomplete-parse-comint-arguments):
* lisp/progmodes/sh-script.el (sh-maybe-here-document):
* lisp/replace.el (query-replace-regexp-eval):
* lisp/savehist.el (savehist-load):
* lisp/simple.el (choose-completion-delete-max-match):
* lisp/term.el (term-dynamic-simple-complete):
* lisp/vc/ediff-init.el (ediff-check-version):
* lisp/vc/ediff-wind.el (ediff-choose-window-setup-function-automatically):
* lisp/vc/vc.el (vc-diff-switches-list):
* lisp/view.el (view-return-to-alist-update): Likewise.

* lisp/iswitchb.el (iswitchb-read-buffer): Move code of
iswitchb-define-mode-map here, and delete that obsolete function.

* lisp/subr.el (eval-next-after-load, makehash, insert-string)
(assoc-ignore-representation, assoc-ignore-case): Use declare to
mark obsolete.
(mode-line-inverse-video): Variable deleted.

* lisp/emacs-lisp/byte-run.el (make-obsolete): Doc fix; emphasize that
this applies to functions.

* lisp/erc/erc.el (erc-send-command): Use define-obsolete-function-alias.

* lisp/international/mule-util.el (string-to-sequence): Remove.

* lisp/net/newst-backend.el (newsticker-cache-filename):
* lisp/net/newst-treeview.el (newsticker-groups-filename): Fix
incorrect obsolescence declaration.

* lisp/net/snmp-mode.el (snmp-font-lock-keywords-3): Don't use obsolete
font-lock-reference-face.

* lisp/url/url-parse.el (url-recreate-url-attributes):
* lisp/url/url-util.el (url-generate-unique-filename): Use declare to mark
obsolete.

* src/xdisp.c (mode_line_inverse_video): Delete obsolete variable.
2012-09-25 12:13:02 +08:00
Chong Yidong
3df47cd5f6 * files.el (ctl-x-map): Bind C-x C-q to read-only-mode.
Fixes: debbugs:12462
2012-09-22 23:44:43 +08:00
Chong Yidong
1667e065d0 * files.el (parse-colon-path): Use split-string.
Fixes: debbugs:12351
2012-09-16 23:57:28 +08:00
Chong Yidong
a8b7cd8d8b Use quit-window for quitting the *Local Variables* buffer.
* lisp/files.el (hack-local-variables-confirm): Use quit-window to kill
the *Local Variables* buffer.
2012-09-09 13:50:43 +08:00
Chong Yidong
0d7eb2ea07 Fix handling of require-final-newline in after-find-file.
* files.el (after-find-file): Don't fail on a read-only buffer if
require-final-newline is `visit' or `visit-save'.

Fixes: debbugs:11156
2012-09-07 18:53:29 +08:00
Martin Rudalics
c5e28e3927 New macro with-temp-buffer-window and related fixes.
* buffer.c (Fdelete_all_overlays): New function.

* window.el (temp-buffer-window-setup-hook)
(temp-buffer-window-show-hook): New hooks.
(temp-buffer-window-setup, temp-buffer-window-show)
(with-temp-buffer-window): New functions.
(fit-window-to-buffer): Remove unused optional argument
OVERRIDE.
(special-display-popup-frame): Make sure the window used shows
BUFFER.

* help.el (temp-buffer-resize-mode): Fix doc-string.
(resize-temp-buffer-window): New optional argument WINDOW.

* files.el (recover-file, save-buffers-kill-emacs):
* dired.el (dired-mark-pop-up): Use with-temp-buffer-window.
2012-09-03 10:54:25 +02:00
Stefan Monnier
af070a1c6a * lisp/simple.el (read-only-mode): Move from lisp/files.el for bootstrapping.
* files.el (read-only-mode): Move to simple.el.
2012-08-29 13:36:49 -04:00
Stefan Monnier
35e62fc984 * lisp/files.el (read-only-mode): New minor mode.
(toggle-read-only): Use it and mark obsolete.
(find-file--read-only):
* lisp/vc/vc.el (vc-next-action, vc-checkout):
* lisp/vc/vc-cvs.el (vc-cvs-checkout):
* lisp/obsolete/vc-mcvs.el (vc-mcvs-update):
* lisp/ffap.el (ffap--toggle-read-only): Update callers.
2012-08-29 11:11:51 -04:00
Glenn Morris
eada086196 Merge from emacs-24; up to 2012-05-04T19:17:01Z!monnier@iro.umontreal.ca 2012-08-28 09:01:59 -07:00
Stefan Monnier
db148c21a9 * lisp/files.el (safe-local-eval-forms): Fix before-save-hook entry to be
buffer-local; add delete-trailing-whitespace.

Fixes: debbugs:12259
2012-08-23 08:19:27 -04:00
Glenn Morris
2a1e24765b Replace version 24.2 with 24.3 where appropriate (hopefully) 2012-08-15 09:29:11 -07:00
Andreas Schwab
1b15d8adcf * files.el (hack-local-variables-filter): Remove useless eval. 2012-08-13 09:37:05 +02:00
Chong Yidong
5725bd2cc0 Merge from emacs-24; up to 2012-05-02T11:38:01Z!lekktu@gmail.com 2012-08-11 10:13:55 +08:00
Juri Linkov
53fa865294 * lisp/files.el (basic-save-buffer): Use `buffer-name' as the default
of `read-file-name' when buffer is not visiting a file.

Fixes: debbugs:12128
2012-08-08 11:17:13 +03:00
Glenn Morris
f40b9f106b hack-local-variables-filter fix for bug#12155
* lisp/files.el (hack-local-variables-filter): If an eval: form is not
known to be safe, and enable-local-variables is :safe, then ignore
the form totally, as is done for non-eval forms.
2012-08-07 14:41:39 -04:00
Chong Yidong
e5d9c0d111 Docfix for kill-buffer-hook and others.
* lisp/files.el (kill-buffer-hook): Provide a defvar.

* src/term.c (Vsuspend_tty_functions, Vresume_tty_functions):
* src/frame.c (Vdelete_frame_functions):
* src/emacs.c (Vkill_emacs_hook): Doc fix.
2012-08-05 15:45:12 +08:00
Chong Yidong
a9dd575408 * files.el (set-auto-mode): Fix invalid setq call. 2012-08-05 11:03:31 +08:00
Eli Zaretskii
6dad71783c Support symlinks on latest versions of MS-Windows.
src/w32.c: Include winioctl.h and aclapi.h.
 (is_symlink, chase_symlinks, enable_privilege, restore_privilege)
 (revert_to_self): Forward declarations of static functions.
 <static BOOL g_b_init_get_security_info>:
 <g_b_init_create_symbolic_link>: New static flags.
 (globals_of_w32): Initialize them to zero.
 (GetSecurityInfo_Proc, CreateSymbolicLink_Proc): New typedefs.
 (map_w32_filename): Improve commentary.  Simplify switch.
 (SYMBOLIC_LINK_FLAG_DIRECTORY): Define if not defined in system
 headers (most versions of MinGW w32api don't).
 (get_security_info, create_symbolic_link)
 (get_file_security_desc_by_handle, is_symlink, chase_symlinks):
 New functions.
 (sys_access, sys_chmod): Call 'chase_symlinks' to resolve symlinks
 in the argument file name.
 (sys_access): Call unc_volume_file_attributes only if
 GetFileAttributes fails with network-related error codes.
 (sys_rename): Diagnose renaming of a symlink when the user doesn't
 have the required privileges.
 (get_file_security_desc_by_name): Renamed from
 get_file_security_desc.
 (stat_worker): New function, with most of the guts of 'stat', and
 with addition of handling of symlinks and support for 'lstat'.  If
 possible, get file's attributes and security information by
 handle, not by name.  Produce S_IFLNK bit for symlinks, when
 called from 'lstat'.
 (stat, lstat): New functions, call 'stat_worker'.
 (symlink, readlink, careadlinkat): Rewritten to create and resolve
 symlinks when the underlying filesystem supports them.

 lib/src/ntlib.c (lstat): New function, calls 'stat'.

 nt/inc/sys/stat.h (S_IFLNK): Define.
 (S_ISLNK): A non-trivial definition.
 (lstat): Prototype instead of a macro that redirects to 'stat'.

 lisp/files.el (file-truename): Don't skip symlink-chasing part on
 windows-nt.  Incorporate the resolution of 8+3 short aliases on
 Windows into the loop that recursively chases symlinks.  Compare
 directory and its parent case-insensitively on MS-Windows and
 MS-DOS.

 etc/NEWS: Announce the symlink support on MS-Windows.
2012-08-03 13:23:30 +03:00
Chong Yidong
b68b33375c Don't warn on toggle-read-only calls.
Clarify the documentation of toggle-read-only, and audit the code tree
for uses of toggle-read-only; where appropriate, switch to setting the
variable buffer-read-only or calling toggle-read-only with a (new)
second arg.

* lisp/files.el (toggle-read-only): Doc fix and code cleanup.  New arg
to allow printing the message when called from Lisp.

* lisp/emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions):
Remove toggle-read-only.

* lisp/bindings.el (mode-line-toggle-read-only):
* lisp/dired.el (dired-toggle-read-only):
* lisp/ibuffer.el (ibuffer-do-toggle-read-only): Call toggle-read-only
with non-nil second arg.

* lisp/bs.el (bs-toggle-readonly):
* lisp/buff-menu.el (Buffer-menu-toggle-read-only): Remove
with-no-warnings around toggle-read-only.

* lisp/ffap.el (ffap--toggle-read-only): Accept a list of buffers.
Remove with-no-warnings around toggle-read-only.
(ffap-read-only, ffap-read-only-other-window)
(ffap-read-only-other-frame): Callers changed.

* lisp/help-mode.el: Don't require view package.
(help-mode-finish): Set buffer-read-only instead of calling
toggle-read-only.

* lisp/emacs-lisp/eieio-custom.el (eieio-customize-object):
* lisp/vc/ediff.el (ediff-set-read-only-in-buf-A): Set buffer-read-only
directly.

* lisp/gnus/smime.el (smime-certificate-info): Set buffer-read-only directly,
instead of calling toggle-read-only with a (bogus) argument.

* doc/emacs/buffers.texi (Misc Buffer): Document view-read-only.

* doc/lispref/buffers.texi (Read Only Buffers): Document toggle-read-only
changes.  Reword to account for the fact that read-only is currently not
supported in overlay properties.
2012-07-13 15:06:09 +08:00
Glenn Morris
133a11fc59 * lisp/files.el (toggle-read-only): Restrict message to interactive use. 2012-07-06 15:06:54 -04:00
Chong Yidong
226c3633fd Merge from emacs-24; up to 2012-05-01T00:16:02Z!rgm@gnu.org 2012-07-06 12:31:46 +08:00
Stefan Monnier
0781098af7 * lisp/files.el (locate-dominating-file): Allow `name' to be a predicate.
(find-file--read-only): New function.
(find-file-read-only, find-file-read-only-other-window)
(find-file-read-only-other-frame): Use it.
(insert-file-contents-literally): Don't `fset'.
(get-free-disk-space): Use locate-dominating-file.
2012-07-04 11:59:12 -04:00
Eli Zaretskii
93842198fc Fix bug #11827 with file-relative-name on MS-Windows.
lisp/files.el (file-relative-name): Compare file names
 case-insensitively if on MS-Windows or MS-DOS, or if
 read-file-name-completion-ignore-case is non-nil.  Don't use
 case-fold-search for this purpose.
2012-07-01 19:38:53 +03:00
Sam Steingold
d2c32364fd * lisp/files.el (file-name-base): New convenience function.
* lisp/autoinsert.el, lisp/cus-dep.el, lisp/doc-view.el, lisp/image-dired.el,
* lisp/woman.el, lisp/eshell/esh-cmd.el, lisp/progmodes/ada-xref.el,
* lisp/progmodes/cc-defs.el, lisp/progmodes/cperl-mode.el,
* lisp/progmodes/flymake.el, lisp/progmodes/gud.el, lisp/progmodes/idlwave.el,
* lisp/textmodes/ispell.el, lisp/textmodes/reftex-ref.el,
* lisp/textmodes/tex-mode.el: Use it.
Did not touch cedet and org because they are maintained elsewhere.
2012-06-26 12:23:01 -04:00
Stefan Monnier
36cec983d4 Further GV/CL cleanups.
* lisp/emacs-lisp/gv.el (gv-get): Autoload functions to find their
gv-expander.
(gv--defun-declaration): New function.
(defun-declarations-alist): Use it.
(gv-define-modify-macro, gv-pushnew!, gv-inc!, gv-dec!): Remove.
(gv-place): Autoload.
* lisp/emacs-lisp/cl.el (cl--dotimes, cl--dolist): Remember subr.el's
original definition of dotimes and dolist.
* lisp/emacs-lisp/cl-macs.el (cl-expr-access-order): Remove unused.
(cl-dolist, cl-dotimes): Use `dolist' and `dotimes'.
* lisp/emacs-lisp/cl-lib.el: Move gv handlers from cl-macs to here.
(cl-fifth, cl-sixth, cl-seventh, cl-eighth)
(cl-ninth, cl-tenth): Move gv handler to the function's definition.
* lisp/emacs-lisp/cl-extra.el (cl-subseq, cl-get, cl-getf): Move gv handler
to the function's definition.
* lisp/Makefile.in (COMPILE_FIRST): Re-order to speed it up by about 50%.
* lisp/window.el:
* lisp/files.el:
* lisp/faces.el:
* lisp/env.el: Don't use CL.
2012-06-22 17:24:54 -04:00
Bastien Guerry
76386c5a98 Fix bug #11726 -- send a message after `toggle-read-only'.
Thanks to Drew Adam for reporting this.
2012-06-22 16:12:42 +02:00
Stefan Monnier
2ee3d7f0aa Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv.  Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv.  Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el.  Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.

Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
Sam Steingold
54c5ba1a5f * lisp/files.el (abort-if-file-too-large): Use `file-size-human-readable'. 2012-06-14 15:55:28 -04:00
Stefan Monnier
5a315f9ce9 * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Don't add print-func.
* lisp/files.el: Require cl-lib.
(file-name-non-special): Replace case -> cl-case.
2012-06-13 16:52:25 -04:00
Stefan Monnier
513749ee18 Clean up scoping rule of predefined single-word vars.
* lisp/startup.el (argv, argi): Make lexically scoped.
* lisp/emacs-lisp/float-sup.el (pi): Use internal-make-var-non-special.
* lisp/emacs-lisp/cl-macs.el: Use lexical-binding.
Rename cl-bind-* to cl--bind-*.
* lisp/files.el: Don't require `cl' since it doesn't use it.
* lisp/emacs-lisp/pcase.el, lisp/emacs-lisp/macroexp.el: Add coding cookie.
* src/eval.c (Fmake_var_non_special): New primitive.
(syms_of_eval): Defsubr it.
* src/lread.c (syms_of_lread): Mark `values' as lexically scoped.
2012-06-08 09:18:26 -04:00
Michael Albinus
dfb308badd * files.el (enable-remote-dir-locals): New option.
(hack-dir-local-variables): Use it.  (Bug#1933, Bug#6731)
2012-06-06 14:34:09 +02:00
Glenn Morris
532f361c96 Fix previous (slogin and rlogin not appropriate for remote-shell-program) 2012-05-24 17:27:22 -04:00
Glenn Morris
ead5edc086 Move prune-directory-list, remote-shell-program from paths.el to files.el
* lisp/paths.el (prune-directory-list, remote-shell-program): Move to ...
* lisp/files.el (prune-directory-list, remote-shell-program): ...here.
For the latter, delay initialization, prefer ssh, just search PATH.
2012-05-24 16:40:19 -04:00
Stefan Monnier
e5bd0a2895 Move define-obsolete-variable-alias before the var's definition.
* lisp/vc/log-edit.el (vc-comment-ring, vc-comment-ring-index):
* lisp/tooltip.el (tooltip-hook):
* lisp/textmodes/reftex-toc.el (reftex-toc-map):
* lisp/textmodes/reftex-sel.el (reftex-select-label-map)
(reftex-select-bib-map):
* lisp/textmodes/reftex-index.el (reftex-index-map)
(reftex-index-phrases-map):
* lisp/speedbar.el (speedbar-syntax-table, speedbar-key-map):
* lisp/progmodes/meta-mode.el (meta-mode-map):
* lisp/novice.el (disabled-command-hook):
* lisp/loadhist.el (unload-hook-features-list):
* lisp/frame.el (blink-cursor):
* lisp/files.el (find-file-not-found-hooks, write-file-hooks)
(write-contents-hooks):
* lisp/emulation/tpu-edt.el (GOLD-map):
* lisp/emacs-lock.el (emacs-lock-from-exiting):
* lisp/emacs-lisp/generic.el (generic-font-lock-defaults):
* lisp/emacs-lisp/chart.el (chart-map):
* lisp/dos-fns.el (register-name-alist):
* lisp/dired-x.el (dired-omit-files-p):
* lisp/desktop.el (desktop-enable):
* lisp/cus-edit.el (custom-mode-hook):
* lisp/buff-menu.el (buffer-menu-mode-hook):
* lisp/bookmark.el (bookmark-read-annotation-text-func)
(bookmark-exit-hooks):
* lisp/allout.el (allout-mode-deactivate-hook)
(allout-exposure-change-hook, allout-structure-added-hook)
(allout-structure-deleted-hook, allout-structure-shifted-hook):
* lisp/dirtrack.el (dirtrack-toggle, dirtrackp, dirtrack-debug-toggle)
(dirtrack-debug): Move call to define-obsolete-variable-alias so it
comes before the corresponding variable's definition.
2012-05-12 23:05:06 -04:00
Glenn Morris
666b903b91 Merge from emacs-24; up to 2012-04-21T14:12:27Z!sdl.web@gmail.com 2012-05-08 20:06:08 -07:00
Glenn Morris
ad89bb83f7 * lisp/files.el (auto-mode-alist): Treat ".make" like ".mk". 2012-05-08 13:23:09 -04:00
Glenn Morris
188d270185 Improve previous dir-locals-read-from-file change 2012-05-06 21:29:59 -07:00
Glenn Morris
fd075e7b2b * files.el (dir-locals-read-from-file): Mention dir-locals in any error message. 2012-05-06 10:57:28 -07:00
Ransom Williams
248da2f497 * lisp/files.el (file-auto-mode-skip): New var.
(set-auto-mode-1): Use it.
2012-05-04 23:21:47 -04:00
Stefan Monnier
71873e2b33 Add new error and function `user-error'.
* lisp/subr.el (user-error): New function.
* lisp/window.el (switch-to-buffer):
* lisp/vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
(smerge-match-conflict):
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element, goto-history-element, undo-more)
(undo-start):
* lisp/progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
(find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
(next-file, tags-loop-scan, list-tags, complete-tag):
* lisp/progmodes/compile.el (compilation-loop):
* lisp/mouse.el (mouse-minibuffer-check):
* lisp/man.el (Man-bgproc-sentinel, Man-goto-page):
* lisp/info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
(Info-history-forward, Info-follow-reference, Info-menu)
(Info-extract-menu-item, Info-extract-menu-counting)
(Info-forward-node, Info-backward-node, Info-next-menu-item)
(Info-last-menu-item, Info-next-preorder, Info-last-preorder)
(Info-next-reference, Info-prev-reference, Info-index)
(Info-index-next, Info-follow-nearest-node)
(Info-copy-current-node-name):
* lisp/imenu.el (imenu--make-index-alist)
(imenu-default-create-index-function, imenu-add-to-menubar):
* lisp/files.el (basic-save-buffer, recover-file):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* lisp/emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
(checkdoc-message-text, checkdoc-defun):
* lisp/dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
* lisp/cus-edit.el (customize-changed-options, customize-rogue)
(customize-saved, custom-variable-set, custom-variable-mark-to-save)
(custom-variable-mark-to-reset-standard)
(custom-variable-reset-backup, custom-face-mark-to-reset-standard)
(custom-file):
* lisp/completion.el (check-completion-length):
* lisp/comint.el (comint-search-arg)
(comint-previous-matching-input-string-position)
(comint-previous-matching-input)
(comint-replace-by-expanded-history-before-point, comint-send-input)
(comint-copy-old-input, comint-backward-matching-input)
(comint-goto-process-mark, comint-set-process-mark):
* lisp/calendar/calendar.el (calendar-cursor-to-date): Use it.
* lisp/bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
* src/data.c (PUT_ERROR): New macro.
(syms_of_data): Use it.  Add new error type `user-error'.
* src/undo.c (user_error): New function.
(Fprimitive_undo): Use it.
* src/print.c (print_error_message): Adjust print style for `user-error'.
* src/keyboard.c (user_error): New function.
(Fexit_recursive_edit, Fabort_recursive_edit): Use it.
2012-05-04 19:16:47 -04:00
Stefan Monnier
8a61ee2295 * lisp/files.el (automount-dir-prefix): Mark as obsolete. 2012-05-04 15:14:42 -04:00
Stefan Monnier
0d42eb3e96 * lisp/vc/vc-mtn.el:
* lisp/vc/vc-hg.el:
* lisp/vc/vc-git.el:
* lisp/vc/vc-dir.el:
* lisp/vc/vc-cvs.el:
* lisp/vc/vc-bzr.el:
* lisp/vc/vc-arch.el:
* lisp/vc/vc.el: Replace lexical-let by lexical-binding.
* lisp/minibuffer.el (lazy-completion-table): Avoid ((λ ...) ...).
* lisp/emacs-lisp/cl-macs.el (lexical-let): Fix use in lexical-binding.
* lisp/emacs-lisp/cconv.el (cconv-analyse-form): Warn use of ((λ ...) ...).
2012-04-25 23:18:47 -04:00
Leo Liu
5055880d39 * lisp/files.el (auto-mode-alist): Use javascript-mode instead. 2012-04-25 22:47:33 +08:00
Christopher Schmidt
c09c46b263 Fix require-final-newline interaction with read-only buffers.
* lisp/files.el (after-find-file): Do not try to add a final newline
if the buffer is read-only.

Fixes: debbugs:11156
2012-04-18 14:24:13 +08:00
Glenn Morris
35dc09a19c Merge from emacs-24, up to 2012-04-10T02:06:19Z!larsi@gnus.org 2012-04-13 18:46:06 -07:00
Glenn Morris
4a427f5883 * lisp/files.el (dir-locals-set-class-variables): Doc fix. 2012-04-10 00:13:54 -07:00
Glenn Morris
fd06db5dd6 Remove ucs-set-table-for-input dead code
This function was removed with ucs-tables.el in 2008.

* lisp/international/mule-cmds.el (set-default-coding-systems):
* lisp/files.el (normal-mode):
Remove guarded calls to ucs-set-table-for-input. 

* src/buffer.c (Qucs_set_table_for_input): Remove.
(Fget_buffer_create): Don't call Qucs_set_table_for_input.
(init_buffer_once, syms_of_buffer): Remove Qucs_set_table_for_input.

Fixes: debbugs:9821
2012-04-08 17:58:00 -07:00
Chong Yidong
42ee526b1a Rename file-subdir-of-p to file-in-directory-p.
* lisp/files.el (file-in-directory-p): Rename from file-subdir-of-p.
Handle root directory properly.
(copy-directory): Caller changed.

* lisp/dired-aux.el (dired-copy-file-recursive, dired-create-files):
* lisp/net/tramp.el (tramp-file-name-for-operation): Callers changed.

* doc/lispref/files.texi (Kinds of Files): file-subdir-of-p renamed to
file-in-directory-p.
2012-04-01 10:44:24 +08:00
Thierry Volpiatto
40311efcba Fix copying of symlinks.
* dired-aux.el (dired-copy-file-recursive, dired-create-files):
Check if file is a symlink (Bug#10489).

* files.el (copy-directory): Likewise.
2012-03-31 00:49:29 +08:00
Glenn Morris
02243d9dc1 More small edits for lispref/os.texi
* doc/lispref/os.texi (Killing Emacs): Copyedits.
(Suspending Emacs): Copyedits.  Mention not very relevant with GUIs.
Shorten the example, use more standard shell prompts.

* lisp/files.el (save-buffers-kill-emacs): Doc fix.
2012-03-25 18:35:47 -07:00
Stefan Monnier
1acad97c3e * lisp/files.el (move-file-to-trash): Files aren't regexps.
Fixes: debbugs:11055
2012-03-21 13:44:55 -04:00
Glenn Morris
f7fd3d79b7 Another dir-locals iteration
* lisp/files.el (dir-locals-find-file):
Don't check result is regular, readable.
(dir-locals-read-from-file): Demote errors.
2012-03-08 22:21:49 -05:00
Glenn Morris
9a40b8d45e Undo 2012-03-06T08:22:42Z!rgm@gnu.org
* lisp/files.el (locate-dominating-file, dir-locals-find-file):
Undo 2012-03-06 change.
2012-03-07 22:06:28 -08:00
Glenn Morris
99a8306435 Tweak previous dir-locals-find-file change
* lisp/files.el (locate-dominating-file): Add optional predicate argument.
(dir-locals-find-file): Make use of above change.
2012-03-06 00:22:42 -08:00
Glenn Morris
8f2114eef3 dir-locals-find-file tweak for "odd" .dir-locals.el (bug#10928)
* lisp/files.el (dir-locals-find-file):
Ignore non-readable or non-regular files.
2012-03-05 21:50:28 -05:00
Glenn Morris
eb18244605 * lisp/files.el (locate-dominating-file): Doc fix. 2012-03-05 21:31:32 -05:00
Michael Albinus
a032a70212 * files.el (file-equal-p): Fix docstring. Avoid unnecessary
access of FILE2, if FILE1 does not exist.
2012-03-01 09:33:50 +01:00
thierry volpiatto
96b4930127 * lisp/files.el (file-equal-p): renamed from `files-equal-p'.
Now return nil when one or both files doesn't exists.
(file-subdir-of-p): Now only top directory must exists,
return nil if it doesn't.
(copy-directory): No need to test with `file-subdir-of-p' after creating dir.
* tramp.el (tramp-file-name-for-operation): Rename `files-equal-p' to `file-equal-p'.
* files.texi: Rename `files-equal-p' to `file-equal-p'.
2012-02-28 10:28:52 +01:00
Glenn Morris
44e97401cd Standardize possessive apostrophe usage in manuals, docs, and comments
Ref: http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00649.html
2012-02-28 00:17:21 -08:00
Chong Yidong
9a4888c093 Code and doc fixes for file-subdir-of-p and files-equal-p.
* lisp/files.el (files-equal-p): Doc fix.
(file-subdir-of-p): Doc fix.  Convert loop macro to plain Lisp,
and quit the loop once a mismatch is found.

* doc/lispref/files.texi (Kinds of Files): Improve documentation of
files-equal-p and file-subdir-of-p.
2012-02-26 17:08:19 +08:00
Glenn Morris
ec70a47da9 Fix previous change files.el change 2012-02-24 14:25:38 -05:00
thierry volpiatto
25b2e303b0 Fix bug#10489: 24.0.92 `dired-do-copy' may create infinite directory hierarchy.
* lisp/files.el (files-equal-p): New, simple equality check between two filename.
(file-subdir-of-p): New, Check if dir1 is subdir of dir2.
(copy-directory): Return error when trying to copy a directory on itself.
Add missing copy-contents arg to tramp handler.

* lisp/dired-aux.el (dired-copy-file-recursive): Same.
(dired-create-files): Modify destination when source is equal to dest when copying files.
Return also when dest is a subdir of source.
2012-02-24 19:04:03 +01:00
Glenn Morris
b011fbfe6c Doc fixes for remote-file-name-inhibit-cache
* doc/lispref/files.texi (Magic File Names):
Tweak remote-file-name-inhibit-cache entry.
* lisp/files.el (remote-file-name-inhibit-cache): Doc fixes.
* etc/NEWS: Edits.
2012-02-10 00:08:23 -08:00
Glenn Morris
cf3aa21bc8 * lisp/files.el (rename-uniquely): Doc fix. (Bug#3806) 2012-02-09 15:27:54 -05:00
Glenn Morris
8f05da4228 Document revert-buffer-in-progress-p
* doc/lispref/backups.texi (Reverting): Mention revert-buffer-in-progress-p.
* lisp/files.el (revert-buffer): Doc fix (mention revert-buffer-in-progress-p).
* etc/NEWS: Related markup.
2012-02-04 14:04:12 -08:00
Paul Eggert
b13f806e12 Spelling fix. 2012-01-23 11:44:28 -08:00
Glenn Morris
7b447e9bda File-local variable fixes.
* lisp/files.el (local-enable-local-variables): Doc fix.
(inhibit-local-variables-regexps): Rename from inhibit-first-line-modes-regexps.
Keep old name as obsolete alias.  Doc fix.
Add some extensions from auto-coding-alist.
(inhibit-local-variables-suffixes):
Rename from inhibit-first-line-modes-suffixes.  Doc fix.
(inhibit-local-variables-p): New function, extracted from set-auto-mode-1.
(set-auto-mode): Doc fix.  Respect inhibit-local-variables-regexps.
(set-auto-mode-1): Doc fix.  Use inhibit-local-variables-p.
(hack-local-variables): Doc fix.
Make the mode-only case respect enable-local-variables and friends.
Respect inhibit-local-variables-regexps for file-locals,
but not for directory-locals.
(set-visited-file-name): Take account of inhibit-local-variables-regexps.
Whether it applies may change as the file name is changed.
* lisp/jka-cmpr-hook.el (jka-compr-install):
* lisp/jka-compr.el (jka-compr-uninstall):
Update for inhibit-first-line-modes-suffixes name change.

* etc/NEWS: Mention this change.

Fixes: debbugs:10506
2012-01-20 16:41:05 -08:00
Glenn Morris
f3860cea15 files.el doc fixes.
* lisp/files.el (auto-mode-alist, inhibit-first-line-modes-regexps)
(set-auto-mode): Doc fixes.
2012-01-17 20:33:19 -05:00
Paul Eggert
9a0115abd1 Merge from trunk. 2012-01-07 11:51:13 -08:00
Chong Yidong
89bd9ccd5b More customization-related documentation updates.
* doc/emacs/custom.texi (Specifying File Variables): The mode: keyword
doesn't have to be first anymore.  Add example of specifying minor
modes.
(Directory Variables): Simplify example.  Mention application to
non-file buffers.
(Disabling): Use "initialization file" terminology.
(Init Examples): Fix hook example.

* doc/lispref/variables.texi (Directory Local Variables): Document
hack-dir-local-variables-non-file-buffer.

* lisp/files.el (hack-dir-local-variables-non-file-buffer): Add doc.
(hack-one-local-variable-eval-safep): Allow 0 arg for minor mode
functions, along with 1 and -1.
2012-01-06 18:53:41 +08:00
Glenn Morris
acaf905b11 Add 2012 to FSF copyright years for Emacs files 2012-01-05 01:46:05 -08:00
Paul Eggert
6bb72cbd8b * files.el (move-file-to-trash): Preserve default file modes on error. 2011-12-29 13:08:18 -08:00
Drew Adams
bace743a4a * files.el (file-remote-p): Fix docstring. (Bug#10319) 2011-12-21 19:33:38 +01:00
Paul Eggert
c80e3b4aed Spelling fixes. 2011-12-04 00:02:42 -08:00
Stefan Monnier
24510c22a3 * lisp/files.el (find-file): Don't use force-same-window.
* lisp/window.el (switch-to-buffer): Better match Emacs-23 behavior and only
use pop-to-buffer if the selected window can't be used.
(pop-to-buffer-same-window): Use display-buffer--same-window-action.

Fixes: debbugs:10144
2011-11-28 14:43:52 -05:00
Paul Eggert
e1dbe924b5 Spelling fixes. 2011-11-19 18:29:42 -08:00
Paul Eggert
8350f087ef Spelling fixes. 2011-11-14 12:23:26 -08:00
Glenn Morris
b2621720c3 toggle-read-only fixes for bugs#7292, 10006.
* doc/lispref/buffers.texi (Read Only Buffers): Expand a bit on why
toggle-read-only should only be used interactively.

* lisp/files.el (toggle-read-only): Mention that it should only
be used interactively.

* lisp/emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions):
Add toggle-read-only.
2011-11-09 21:17:45 -05:00
Stefan Monnier
05a61ee3e6 * lisp/files.el (find-file): Always use selected-window. 2011-11-07 09:34:02 -05:00
Glenn Morris
51bc5f8b73 Make set-visited-file-name reload local variables if needed.
* lisp/files.el (set-visited-file-name):
If the major-mode changed, reload the local variables.

Fixes: debbugs:9796
2011-10-26 23:38:32 -07:00
Chong Yidong
86c6068184 Make vc-toggle-read-only an alias for toggle-read-only.
It hasn't worked in a VC sense since 2008-05-02T07:12:59Z!esr@snark.thyrsus.com, though this was
not documented at the time (grr).

* lisp/vc/vc-hooks.el (vc-toggle-read-only): Make it an obsolete alias
for toggle-read-only.  Note that this hasn't called vc-next-action
since 2008-05-02, though it wasn't documented at the time.

* lisp/files.el (toggle-read-only): Remove obsolete comment about
version control.

* doc/emacs/buffers.texi (Misc Buffer): Don't mention vc-toggle-read-only.

* lisp/cedet/ede.el (ede-maybe-checkout): Function deleted;
vc-toggle-read-only does not do version control now.

* lisp/cedet/ede/project-am.el (project-remove-file, project-add-file)
(project-new-target): Don't call ede-maybe-checkout.

* lisp/cedet/ede/util.el (ede-make-buffer-writable): Don't use
vc-toggle-read-only.

* lisp/vc/ediff-init.el (ediff-toggle-read-only-function): Use
toggle-read-only.
2011-10-23 11:38:23 +08:00
Michael Albinus
28dbc92f2c Fix Bug#6019, Bug#9315.
* files.el (set-auto-mode): Call `file-name-sans-versions' for the
complete `buffer-file-name', the local file name part could look
remotely (for example on VMS).

* net/ange-ftp.el (ange-ftp-run-real-handler): Make it an alias of
`tramp-run-real-handler'.
(ange-ftp-fix-name-for-vms): Handle the case, where `name' is
already quoted by '"'.

* net/tramp.el (tramp-rfn-eshadow-update-overlay): Ignore errors.
Let `file-name-handler-alist' be nil, the local file name part
could look remotely (for example on VMS).
2011-10-12 20:32:35 +02:00
Michael Albinus
e74f1bb6f8 * files.el (copy-directory): Set directory attributes only in case
they could be retrieved from the source directory.  (Bug#9565)
2011-09-22 12:00:07 +02:00
Chong Yidong
3aace4e4b3 Allow visiting files with malformed prop-lines.
* files.el (inhibit-first-line-modes-regexps): Add image files.
(hack-local-variables-prop-line): Return nil for malformed prop-lines.

Fixes: debbugs:9044
2011-09-18 11:30:10 -04:00
Chong Yidong
64b5194776 * dired-aux.el (dired-mark-read-string): Don't use default value on empty input.
(dired-do-chxxx): Treat empty input for "touch" as no -t option.
Omit initial minibuffer contents.
(dired-do-chmod): Signal an error on empty input.
(dired-mark-read-string): Don't return default on empty input.

* files.el (file-modes-symbolic-to-number): Doc fix.

Fixes: debbugs:9361
2011-09-12 16:45:56 -04:00
Leo Liu
3d03de90fb Remove unused variable find-file-not-true-dirname-list
See http://debbugs.gnu.org/9422.
2011-09-03 09:41:27 +08:00
Chong Yidong
c33134511b Remove pop-to-buffer-same-window.
* lisp/window.el (pop-to-buffer-1, pop-to-buffer-same-window): Deleted.
(pop-to-buffer): Change interactive spec.  Pass second argument
directly to display-buffer.
(display-buffer): Fix interactive spec.  Use functionp to
distinguish between a function and a list of functions.

* lisp/abbrev.el (edit-abbrevs):
* lisp/arc-mode.el (archive-extract):
* lisp/autoinsert.el (auto-insert):
* lisp/bookmark.el (bookmark-bmenu-list):
* lisp/files.el (find-file):
* lisp/view.el (view-buffer):
* lisp/progmodes/compile.el (compilation-goto-locus):
* lisp/textmodes/bibtex.el (bibtex-initialize): Use switch-to-buffer.

* lisp/org/ob-ref.el (org-babel-ref-goto-headline-id):
* lisp/org/org.el (org-get-location, org-tree-to-indirect-buffer)
(org-mark-ring-goto, org-refile, org-add-log-note)
(org-revert-all-org-buffers, org-switchb)
(org-cycle-agenda-files, org-submit-bug-report)
(org-goto-marker-or-bmk):
* lisp/org/org-agenda.el (org-prepare-agenda, org-agenda-switch-to):
* lisp/org/org-capture.el (org-capture-goto-target)
(org-capture-fill-template):
* lisp/org/org-clock.el (org-clock-goto):
* lisp/org/org-ctags.el (org-ctags-visit-buffer-or-file):
* lisp/org/org-exp.el (org-export-as-org):
* lisp/org/org-feed.el (org-feed-show-raw-feed):
* lisp/org/org-html.el (org-export-htmlize-generate-css):
* lisp/org/org-id.el (org-id-goto):
* lisp/org/org-irc.el (org-irc-visit-erc):
* lisp/org/org-mobile.el (org-mobile-apply):
* lisp/org/org-publish.el (org-publish-org-to, org-publish-find-date):
* lisp/org/org-remember.el (org-go-to-remember-target):
* lisp/org/org-src.el (org-src-switch-to-buffer)
(org-edit-fixed-width-region): Use switch-to-buffer.

* lisp/org/org-compat.el (org-pop-to-buffer-same-window): Deleted.
2011-09-02 12:38:40 -04:00
Glenn Morris
8e999f70ab * lisp/files.el (hack-local-variables): Fully ignore case for "mode:". 2011-08-20 15:26:52 -07:00
Glenn Morris
9234ff7fcf files.el fix for bug#9331
* lisp/files.el (hack-local-variables-prop-line, hack-local-variables):
Downcase "Mode:".
2011-08-19 14:23:09 -04:00
Lars Magne Ingebrigtsen
3ee3a1b538 Make `buffer-offer-save' permanently local
Fixes: debbugs:6241
2011-07-16 22:01:37 +02:00
Lars Magne Ingebrigtsen
bd2fcc8d5c (make-directory): Clarify that an error will be raised if there's an error
Fixes: debbugs:6387
2011-07-14 00:22:08 +02:00
Lars Magne Ingebrigtsen
7152b011c2 Give better error messages when trying to load non-existent symlinks
* files.el (after-find-file): Give a better error message when
trying to find a symlink that points to a file that doesn't exist
(bug#4398).
2011-07-13 01:25:50 +02:00
Leo Liu
481a51b660 Only do the `C-x C-q' warning on VC backends where it makes sense.
Fixes: debbugs:2623
2011-07-11 15:56:49 +02:00
Stefan Monnier
c8af70e11e * lisp/files.el (find-file): Use pop-to-buffer-same-window.
* lisp/emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions):
Add switch-to-buffer.

Fixes: debbugs:8911
2011-07-04 12:08:16 -04:00
Lars Magne Ingebrigtsen
28fd8759b3 * files.el (file-expand-wildcards): Ignore non-readable
sub-directories while trying to find matches instead of signalling
an error (bug#6297).
2011-07-03 03:48:07 +02:00
Chong Yidong
658d8eb8fc Avoid calling customize-save-variable during startup (Bug#8720).
* lisp/cus-edit.el (customize-push-and-save): New function.

* lisp/files.el (hack-local-variables-confirm): Use it.

* lisp/custom.el (load-theme): New arg NO-CONFIRM.  Use
customize-push-and-save (Bug#8720).
(custom-enabled-themes): Doc fix.

* lisp/cus-theme.el (customize-create-theme)
(custom-theme-merge-theme): Callers to load-theme changed.
2011-06-29 21:39:52 -04:00
Glenn Morris
faf2a1741d * lisp/files.el (auto-mode-alist): Add .f03, .f08 for f90-mode. 2011-06-29 14:38:39 -04:00
Chong Yidong
56f9dcc930 Fix last change. 2011-06-19 14:59:58 -04:00
Chong Yidong
4ca009e5a8 * lisp/files.el (auto-mode-alist): Entry for m2-mode (Bug#8852). 2011-06-19 14:53:49 -04:00
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