aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog44
-rw-r--r--lisp/frame.el1
-rw-r--r--lisp/gnus/ChangeLog6
-rw-r--r--lisp/gnus/gnus-sum.el7
-rw-r--r--lisp/net/tramp-adb.el60
-rw-r--r--lisp/net/tramp-sh.el3
-rw-r--r--lisp/net/tramp-smb.el5
-rw-r--r--lisp/net/tramp.el37
-rw-r--r--lisp/textmodes/ispell.el83
-rw-r--r--lisp/textmodes/reftex-cite.el2
-rw-r--r--lisp/textmodes/reftex-vars.el12
-rw-r--r--src/ChangeLog13
-rw-r--r--src/fileio.c176
-rw-r--r--src/w32.c80
14 files changed, 349 insertions, 180 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d439c661401..6121ff190e8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,47 @@
12013-01-21 Agustín Martín Domingo <agustin.martin@hispalinux.es>
2
3 * textmodes/ispell.el (ispell-hunspell-dictionary-equivs-alist):
4 New variable to map standard dict names to hunspell ones.
5 (ispell-set-spellchecker-params): Make sure specific dict names
6 are used for standard dicts with hunspell.
7
82013-01-21 Tassilo Horn <tsdh@gnu.org>
9
10 * textmodes/reftex-cite.el (reftex-format-citation): Add format
11 chars for note (%N) and url (%U).
12 * textmodes/reftex-vars.el (reftex-cite-format): Document them.
13
142013-01-21 Juri Linkov <juri@jurta.org>
15
16 * frame.el: Bind `f10' in `esc-map' to `toggle-frame-maximized'
17 in addition to existing separate binding `meta f10' in `global-map'.
18 (Bug#13484)
19
202013-01-21 Michael Albinus <michael.albinus@gmx.de>
21
22 Improve XEmacs compatibility.
23
24 * net/tramp.el (tramp-replace-environment-variables): Make it a defun.
25
26 * net/tramp-adb.el (top): Require `time-date'.
27 (tramp-adb-ls-output-time-less-p): Use `tramp-time-less-p'.
28 (tramp-adb-handle-copy-file, tramp-adb-handle-rename-file): Use
29 `tramp-file-name-handler'.
30 (tramp-adb-maybe-open-connection): Use
31 `tramp-compat-set-process-query-on-exit-flag'.
32
33 * net/tramp-sh.el (tramp-sh-handle-file-acl): Use
34 `tramp-compat-funcall'.
35
36 * net/tramp-smb.el (tramp-smb-handle-file-acl): Use `looking-at' and
37 `tramp-compat-funcall'.
38
392013-01-21 Jürgen Hötzel <juergen@archlinux.org>
40
41 * net/tramp-adb.el (tramp-adb-handle-start-file-process): Complete
42 reimplementation using "adb shell command ..." instead of running
43 remote shell interactively.
44
12013-01-20 Glenn Morris <rgm@gnu.org> 452013-01-20 Glenn Morris <rgm@gnu.org>
2 46
3 * emacs-lisp/lisp-mode.el (emacs-lisp-mode-map): 47 * emacs-lisp/lisp-mode.el (emacs-lisp-mode-map):
diff --git a/lisp/frame.el b/lisp/frame.el
index 243f524c403..2c17b781caa 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1707,6 +1707,7 @@ See also `toggle-frame-maximized'."
1707(define-key ctl-x-5-map "o" 'other-frame) 1707(define-key ctl-x-5-map "o" 'other-frame)
1708(define-key global-map [f11] 'toggle-frame-fullscreen) 1708(define-key global-map [f11] 'toggle-frame-fullscreen)
1709(define-key global-map [(meta f10)] 'toggle-frame-maximized) 1709(define-key global-map [(meta f10)] 'toggle-frame-maximized)
1710(define-key esc-map [f10] 'toggle-frame-maximized)
1710 1711
1711 1712
1712;; Misc. 1713;; Misc.
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 1f1b46c8532..745e0ede5a8 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,9 @@
12013-01-21 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * gnus-sum.el (gnus-summary-read-group-1): Protect against not being
4 able to find the article, which can happen in debbugs groups,
5 apparently.
6
12013-01-16 Glenn Morris <rgm@gnu.org> 72013-01-16 Glenn Morris <rgm@gnu.org>
2 8
3 * smiley.el (smiley-style): Make the file loadable in batch mode. 9 * smiley.el (smiley-style): Make the file loadable in batch mode.
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index ea68a6a2fa5..658863f9f00 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -4058,9 +4058,10 @@ If SELECT-ARTICLES, only select those articles from GROUP."
4058 gnus-auto-select-first) 4058 gnus-auto-select-first)
4059 (progn 4059 (progn
4060 (let ((art (gnus-summary-article-number))) 4060 (let ((art (gnus-summary-article-number)))
4061 (unless (and (not gnus-plugged) 4061 (when (and art
4062 (or (memq art gnus-newsgroup-undownloaded) 4062 gnus-plugged
4063 (memq art gnus-newsgroup-downloadable))) 4063 (not (memq art gnus-newsgroup-undownloaded))
4064 (not (memq art gnus-newsgroup-downloadable)))
4064 (gnus-summary-goto-article art)))) 4065 (gnus-summary-goto-article art))))
4065 ;; Don't select any articles. 4066 ;; Don't select any articles.
4066 (gnus-summary-position-point) 4067 (gnus-summary-position-point)
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index ab13d4cf442..17802d39fa4 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -33,6 +33,7 @@
33;;; Code: 33;;; Code:
34 34
35(require 'tramp) 35(require 'tramp)
36(require 'time-date)
36 37
37(defvar dired-move-to-filename-regexp) 38(defvar dired-move-to-filename-regexp)
38 39
@@ -465,7 +466,7 @@ Emacs dired can't find files."
465 (setq time-a (apply 'encode-time (parse-time-string (match-string 0 a)))) 466 (setq time-a (apply 'encode-time (parse-time-string (match-string 0 a))))
466 (string-match tramp-adb-ls-date-regexp b) 467 (string-match tramp-adb-ls-date-regexp b)
467 (setq time-b (apply 'encode-time (parse-time-string (match-string 0 b)))) 468 (setq time-b (apply 'encode-time (parse-time-string (match-string 0 b))))
468 (time-less-p time-b time-a))) 469 (tramp-time-less-p time-b time-a)))
469 470
470(defun tramp-adb-ls-output-name-less-p (a b) 471(defun tramp-adb-ls-output-name-less-p (a b)
471 "Sort \"ls\" output by name, ascending." 472 "Sort \"ls\" output by name, ascending."
@@ -638,7 +639,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
638 newname (expand-file-name newname)) 639 newname (expand-file-name newname))
639 640
640 (if (file-directory-p filename) 641 (if (file-directory-p filename)
641 (copy-directory filename newname keep-date t) 642 (tramp-file-name-handler 'copy-directory filename newname keep-date t)
642 (with-tramp-progress-reporter 643 (with-tramp-progress-reporter
643 (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) 644 (tramp-dissect-file-name (if (file-remote-p filename) filename newname))
644 0 (format "Copying %s to %s" filename newname) 645 0 (format "Copying %s to %s" filename newname)
@@ -698,7 +699,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
698 (tramp-flush-file-property v localname) 699 (tramp-flush-file-property v localname)
699 ;; Short track. 700 ;; Short track.
700 (tramp-adb-barf-unless-okay 701 (tramp-adb-barf-unless-okay
701 v (format "mv %s %s" (file-remote-p filename 'localname) localname) 702 v (format
703 "mv %s %s"
704 (tramp-file-name-handler 'file-remote-p filename 'localname)
705 localname)
702 "Error renaming %s to %s" filename newname)) 706 "Error renaming %s to %s" filename newname))
703 707
704 ;; Rename by copy. 708 ;; Rename by copy.
@@ -907,15 +911,11 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
907 (cons program args) " ")))) 911 (cons program args) " "))))
908 (tramp-process-connection-type 912 (tramp-process-connection-type
909 (or (null program) tramp-process-connection-type)) 913 (or (null program) tramp-process-connection-type))
910 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
911 (name1 name) 914 (name1 name)
912 (i 0)) 915 (i 0))
913 (unwind-protect 916 (unwind-protect
914 (save-excursion 917 (save-excursion
915 (save-restriction 918 (save-restriction
916 (unless buffer
917 ;; BUFFER can be nil. We use a temporary buffer.
918 (setq buffer (generate-new-buffer tramp-temp-buffer-name)))
919 (while (get-process name1) 919 (while (get-process name1)
920 ;; NAME must be unique as process name. 920 ;; NAME must be unique as process name.
921 (setq i (1+ i) 921 (setq i (1+ i)
@@ -923,35 +923,21 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
923 (setq name name1) 923 (setq name name1)
924 ;; Set the new process properties. 924 ;; Set the new process properties.
925 (tramp-set-connection-property v "process-name" name) 925 (tramp-set-connection-property v "process-name" name)
926 (tramp-set-connection-property v "process-buffer" buffer) 926 (when command
927 ;; Activate narrowing in order to save BUFFER contents. 927 (let* ((host (tramp-file-name-host v))
928 ;; Clear also the modification time; otherwise we might 928 (devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))
929 ;; be interrupted by `verify-visited-file-modtime'. 929 (args (if (> (length host) 0)
930 (with-current-buffer (tramp-get-connection-buffer v) 930 (list "-s" host "shell" command)
931 (let ((buffer-undo-list t)) 931 (list "shell" command)))
932 (clear-visited-file-modtime) 932 (p (apply 'start-process (tramp-get-connection-name v) buffer
933 (narrow-to-region (point-max) (point-max)) 933 (tramp-adb-program) args)))
934 (if command 934 ;; Set sentinel and query flag for this process.
935 ;; Send the command. 935 (tramp-set-connection-property p "vector" v)
936 (tramp-adb-send-command v command) 936 (set-process-sentinel p 'tramp-process-sentinel)
937 ;; Open the connection. 937 (tramp-compat-set-process-query-on-exit-flag p t)
938 (tramp-adb-maybe-open-connection v)))) 938 ;; Return process.
939 (let ((p (tramp-get-connection-process v))) 939 p))))
940 ;; Set sentinel and query flag for this process. 940 (tramp-set-connection-property v "process-name" nil)))))
941 (tramp-set-connection-property p "vector" v)
942 (set-process-sentinel p 'tramp-process-sentinel)
943 (tramp-compat-set-process-query-on-exit-flag p t)
944 ;; Return process.
945 p)))
946 ;; Save exit.
947 (with-current-buffer (tramp-get-connection-buffer v)
948 (if (string-match tramp-temp-buffer-name (buffer-name))
949 (progn
950 (set-process-buffer (tramp-get-connection-process v) nil)
951 (kill-buffer (current-buffer)))
952 (set-buffer-modified-p bmp)))
953 (tramp-set-connection-property v "process-name" nil)
954 (tramp-set-connection-property v "process-buffer" nil)))))
955 941
956;; Helper functions. 942;; Helper functions.
957 943
@@ -1089,7 +1075,7 @@ connection if a previous connection has died for some reason."
1089 (tramp-adb-wait-for-output p) 1075 (tramp-adb-wait-for-output p)
1090 (unless (eq 'run (process-status p)) 1076 (unless (eq 'run (process-status p))
1091 (tramp-error vec 'file-error "Terminated!")) 1077 (tramp-error vec 'file-error "Terminated!"))
1092 (set-process-query-on-exit-flag p nil) 1078 (tramp-compat-set-process-query-on-exit-flag p nil)
1093 1079
1094 ;; Check whether the properties have been changed. If 1080 ;; Check whether the properties have been changed. If
1095 ;; yes, this is a strong indication that we must expire all 1081 ;; yes, this is a strong indication that we must expire all
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index d83599a6662..743c8dbe0f9 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1555,7 +1555,8 @@ be non-negative integers."
1555 (goto-char (point-max)) 1555 (goto-char (point-max))
1556 (delete-blank-lines) 1556 (delete-blank-lines)
1557 (when (> (point-max) (point-min)) 1557 (when (> (point-max) (point-min))
1558 (substring-no-properties (buffer-string)))))))) 1558 (tramp-compat-funcall
1559 'substring-no-properties (buffer-string))))))))
1559 1560
1560(defun tramp-sh-handle-set-file-acl (filename acl-string) 1561(defun tramp-sh-handle-set-file-acl (filename acl-string)
1561 "Like `set-file-acl' for Tramp files." 1562 "Like `set-file-acl' for Tramp files."
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 0f143100906..65c52ae4f3c 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -649,13 +649,14 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
649 v (format "getfacl \"%s\"" (tramp-smb-get-localname v))) 649 v (format "getfacl \"%s\"" (tramp-smb-get-localname v)))
650 (with-current-buffer (tramp-get-connection-buffer v) 650 (with-current-buffer (tramp-get-connection-buffer v)
651 (goto-char (point-min)) 651 (goto-char (point-min))
652 (while (looking-at-p "^#") 652 (while (looking-at "^#")
653 (forward-line) 653 (forward-line)
654 (delete-region (point-min) (point))) 654 (delete-region (point-min) (point)))
655 (goto-char (point-max)) 655 (goto-char (point-max))
656 (delete-blank-lines) 656 (delete-blank-lines)
657 (when (> (point-max) (point-min)) 657 (when (> (point-max) (point-min))
658 (substring-no-properties (buffer-string)))))))) 658 (tramp-compat-funcall
659 'substring-no-properties (buffer-string))))))))
659 660
660(defun tramp-smb-handle-file-attributes (filename &optional id-format) 661(defun tramp-smb-handle-file-attributes (filename &optional id-format)
661 "Like `file-attributes' for Tramp files." 662 "Like `file-attributes' for Tramp files."
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 2c4aac0ac8a..69e82de3f7f 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1779,28 +1779,23 @@ value of `default-file-modes', without execute permissions."
1779 (or (file-modes filename) 1779 (or (file-modes filename)
1780 (logand (default-file-modes) (tramp-compat-octal-to-decimal "0666")))) 1780 (logand (default-file-modes) (tramp-compat-octal-to-decimal "0666"))))
1781 1781
1782(defalias 'tramp-replace-environment-variables 1782(defun tramp-replace-environment-variables (filename)
1783 (if (ignore-errors 1783 "Replace environment variables in FILENAME.
1784 (equal "${ tramp?}"
1785 (tramp-compat-funcall
1786 'substitute-env-vars "${ tramp?}" 'only-defined)))
1787 (lambda (filename)
1788 "Like `substitute-env-vars' with `only-defined' non-nil."
1789 (tramp-compat-funcall 'substitute-env-vars filename 'only-defined))
1790 (lambda (filename)
1791 "Replace environment variables in FILENAME.
1792Return the string with the replaced variables." 1784Return the string with the replaced variables."
1793 (save-match-data 1785 (or (ignore-errors
1794 (let ((idx (string-match "$\\(\\w+\\)" filename))) 1786 (tramp-compat-funcall 'substitute-env-vars filename 'only-defined))
1795 ;; `$' is coded as `$$'. 1787 ;; We need an own implementation.
1796 (when (and idx 1788 (save-match-data
1797 (or (zerop idx) (not (eq ?$ (aref filename (1- idx))))) 1789 (let ((idx (string-match "$\\(\\w+\\)" filename)))
1798 (getenv (match-string 1 filename))) 1790 ;; `$' is coded as `$$'.
1799 (setq filename 1791 (when (and idx
1800 (replace-match 1792 (or (zerop idx) (not (eq ?$ (aref filename (1- idx)))))
1801 (substitute-in-file-name (match-string 0 filename)) 1793 (getenv (match-string 1 filename)))
1802 t nil filename))) 1794 (setq filename
1803 filename))))) 1795 (replace-match
1796 (substitute-in-file-name (match-string 0 filename))
1797 t nil filename)))
1798 filename))))
1804 1799
1805;; In XEmacs, electricity is implemented via a key map for ?/ and ?~, 1800;; In XEmacs, electricity is implemented via a key map for ?/ and ?~,
1806;; which calls corresponding functions (see minibuf.el). 1801;; which calls corresponding functions (see minibuf.el).
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 52e97b8248d..dbcf3910db8 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -773,6 +773,41 @@ here just for backwards compatibility.")
773(make-obsolete-variable 'ispell-aspell-supports-utf8 773(make-obsolete-variable 'ispell-aspell-supports-utf8
774 'ispell-encoding8-command "23.1") 774 'ispell-encoding8-command "23.1")
775 775
776(defvar ispell-hunspell-dictionary-equivs-alist
777 '(("american" "en_US")
778 ("brasileiro" "pt_BR")
779 ("british" "en_GB")
780 ("castellano" "es_ES")
781 ("castellano8" "es_ES")
782 ("czech" "cs_CZ")
783 ("dansk" "da_DK")
784 ("deutsch" "de_DE")
785 ("deutsch8" "de_DE")
786 ("english" "en_US")
787 ("esperanto" "eo")
788 ("esperanto-tex" "eo")
789 ("finnish" "fi_FI")
790 ("francais7" "fr_FR")
791 ("francais" "fr_FR")
792 ("francais-tex" "fr_FR")
793 ("german" "de_DE")
794 ("german8" "de_DE")
795 ("italiano" "it_IT")
796 ("nederlands" "nl_NL")
797 ("nederlands8" "nl_NL")
798 ("norsk" "nn_NO")
799 ("norsk7-tex" "nn_NO")
800 ("polish" "pl_PL")
801 ("portugues" "pt_PT")
802 ("russian" "ru_RU")
803 ("russianw" "ru_RU")
804 ("slovak" "sk_SK")
805 ("slovenian" "sl_SI")
806 ("svenska" "sv_SE")
807 ("hebrew" "he_IL"))
808 "Alist with matching hunspell dict names for standard dict names in
809 `ispell-dictionary-base-alist'.")
810
776(defvar ispell-emacs-alpha-regexp 811(defvar ispell-emacs-alpha-regexp
777 (if (string-match "^[[:alpha:]]+$" "abcde") 812 (if (string-match "^[[:alpha:]]+$" "abcde")
778 "[[:alpha:]]" 813 "[[:alpha:]]"
@@ -1134,9 +1169,57 @@ aspell is used along with Emacs).")
1134 ispell-encoding8-command) 1169 ispell-encoding8-command)
1135 ispell-aspell-dictionary-alist 1170 ispell-aspell-dictionary-alist
1136 nil)) 1171 nil))
1172 (ispell-dictionary-base-alist ispell-dictionary-base-alist)
1137 ispell-base-dicts-override-alist ; Override only base-dicts-alist 1173 ispell-base-dicts-override-alist ; Override only base-dicts-alist
1138 all-dicts-alist) 1174 all-dicts-alist)
1139 1175
1176 ;; While ispell and aspell (through aliases) use the traditional
1177 ;; dict naming originally expected by ispell.el, hunspell
1178 ;; uses locale based names with no alias. We need to map
1179 ;; standard names to locale based names to make default dict
1180 ;; definitions available for hunspell.
1181 (if ispell-really-hunspell
1182 (let (tmp-dicts-alist)
1183 (dolist (adict ispell-dictionary-base-alist)
1184 (let* ((dict-name (nth 0 adict))
1185 (dict-equiv
1186 (cadr (assoc dict-name
1187 ispell-hunspell-dictionary-equivs-alist)))
1188 (ispell-args (nth 5 adict))
1189 (ispell-args-has-d (member "-d" ispell-args))
1190 skip-dict)
1191 ;; Remove "-d" option from `ispell-args' if present
1192 (if ispell-args-has-d
1193 (let ((ispell-args-after-d
1194 (cdr (cdr ispell-args-has-d)))
1195 (ispell-args-before-d
1196 (butlast ispell-args (length ispell-args-has-d))))
1197 (setq ispell-args
1198 (nconc ispell-args-before-d
1199 ispell-args-after-d))))
1200 ;; Unless default dict, re-add "-d" option with the mapped value
1201 (if dict-name
1202 (if dict-equiv
1203 (nconc ispell-args (list "-d" dict-equiv))
1204 (message
1205 "ispell-set-spellchecker-params: Missing hunspell equiv for \"%s\". Skipping."
1206 dict-name)
1207 (setq skip-dict t)))
1208
1209 (unless skip-dict
1210 (add-to-list 'tmp-dicts-alist
1211 (list
1212 dict-name ; dict name
1213 (nth 1 adict) ; casechars
1214 (nth 2 adict) ; not-casechars
1215 (nth 3 adict) ; otherchars
1216 (nth 4 adict) ; many-otherchars-p
1217 ispell-args ; ispell-args
1218 (nth 6 adict) ; extended-character-mode
1219 (nth 7 adict) ; dict encoding
1220 ))))
1221 (setq ispell-dictionary-base-alist tmp-dicts-alist))))
1222
1140 (run-hooks 'ispell-initialize-spellchecker-hook) 1223 (run-hooks 'ispell-initialize-spellchecker-hook)
1141 1224
1142 ;; Add dicts to ``ispell-dictionary-alist'' unless already present. 1225 ;; Add dicts to ``ispell-dictionary-alist'' unless already present.
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 3b294e62b01..079101b56ee 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -1043,6 +1043,7 @@ While entering the regexp, completion on knows citation keys is possible.
1043 ((= l ?k) (reftex-get-bib-field "key" entry)) 1043 ((= l ?k) (reftex-get-bib-field "key" entry))
1044 ((= l ?m) (reftex-get-bib-field "month" entry)) 1044 ((= l ?m) (reftex-get-bib-field "month" entry))
1045 ((= l ?n) (reftex-get-bib-field "number" entry)) 1045 ((= l ?n) (reftex-get-bib-field "number" entry))
1046 ((= l ?N) (reftex-get-bib-field "note" entry))
1046 ((= l ?o) (reftex-get-bib-field "organization" entry)) 1047 ((= l ?o) (reftex-get-bib-field "organization" entry))
1047 ((= l ?p) (reftex-get-bib-field "pages" entry)) 1048 ((= l ?p) (reftex-get-bib-field "pages" entry))
1048 ((= l ?P) (car (split-string 1049 ((= l ?P) (car (split-string
@@ -1050,6 +1051,7 @@ While entering the regexp, completion on knows citation keys is possible.
1050 "[- .]+"))) 1051 "[- .]+")))
1051 ((= l ?s) (reftex-get-bib-field "school" entry)) 1052 ((= l ?s) (reftex-get-bib-field "school" entry))
1052 ((= l ?u) (reftex-get-bib-field "publisher" entry)) 1053 ((= l ?u) (reftex-get-bib-field "publisher" entry))
1054 ((= l ?U) (reftex-get-bib-field "url" entry))
1053 ((= l ?r) (reftex-get-bib-field "address" entry)) 1055 ((= l ?r) (reftex-get-bib-field "address" entry))
1054 ((= l ?t) (reftex-get-bib-field "title" entry)) 1056 ((= l ?t) (reftex-get-bib-field "title" entry))
1055 ((= l ?T) (reftex-abbreviate-title 1057 ((= l ?T) (reftex-abbreviate-title
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index db08ca3a514..2a5c9c55866 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -1125,12 +1125,12 @@ In the format, the following percent escapes will be expanded.
1125%e Works like %a, but on list of editor names. (%2e and %E work a well) 1125%e Works like %a, but on list of editor names. (%2e and %E work a well)
1126 1126
1127It is also possible to access all other BibTeX database fields: 1127It is also possible to access all other BibTeX database fields:
1128%b booktitle %c chapter %d edition %h howpublished 1128%b booktitle %c chapter %d edition %h howpublished
1129%i institution %j journal %k key %m month 1129%i institution %j journal %k key %m month
1130%n number %o organization %p pages %P first page 1130%n number %N note %o organization %p pages
1131%r address %s school %u publisher %t title 1131%P first page %r address %s school %u publisher
1132%v volume %y year 1132%U url %t title %v volume %y year
1133%B booktitle, abbreviated %T title, abbreviated 1133%B booktitle, abbreviated %T title, abbreviated
1134 1134
1135Usually, only %l is needed. The other stuff is mainly for the echo area 1135Usually, only %l is needed. The other stuff is mainly for the echo area
1136display, and for (setq reftex-comment-citations t). 1136display, and for (setq reftex-comment-citations t).
diff --git a/src/ChangeLog b/src/ChangeLog
index 1383b12ed68..ca37bb3ea56 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12013-01-21 Eli Zaretskii <eliz@gnu.org>
2
3 * w32.c (acl_set_file): Don't test for errors unless
4 set_file_security returns FALSE. Avoids spurious errors when
5 saving files.
6
72013-01-21 Dmitry Antipov <dmantipov@yandex.ru>
8
9 * fileio.c (Finsert_file_contents): Revert code introduced at
10 2013-01-18 in favor of the simpler and generally better fix.
11 Save stack space by removing 'buffer' and reusing 'read_buf'
12 where appropriate.
13
12013-01-19 Paul Eggert <eggert@cs.ucla.edu> 142013-01-19 Paul Eggert <eggert@cs.ucla.edu>
2 15
3 * lisp.h (eabs): Define unconditionally (Bug#13419). 16 * lisp.h (eabs): Define unconditionally (Bug#13419).
diff --git a/src/fileio.c b/src/fileio.c
index 51f966787b9..175f363ec92 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3413,13 +3413,13 @@ decide_coding_unwind (Lisp_Object unwind_data)
3413 return Qnil; 3413 return Qnil;
3414} 3414}
3415 3415
3416/* Check quit and read from the file. STATE is a Lisp_Save_Value 3416/* Read from a non-regular file. STATE is a Lisp_Save_Value
3417 object where slot 0 is the file descriptor, slot 1 specifies 3417 object where slot 0 is the file descriptor, slot 1 specifies
3418 an offset to put the read bytes, and slot 2 is the maximum 3418 an offset to put the read bytes, and slot 2 is the maximum
3419 amount of bytes to read. Value is the number of bytes read. */ 3419 amount of bytes to read. Value is the number of bytes read. */
3420 3420
3421static Lisp_Object 3421static Lisp_Object
3422read_contents (Lisp_Object state) 3422read_non_regular (Lisp_Object state)
3423{ 3423{
3424 int nbytes; 3424 int nbytes;
3425 3425
@@ -3435,10 +3435,12 @@ read_contents (Lisp_Object state)
3435 return make_number (nbytes); 3435 return make_number (nbytes);
3436} 3436}
3437 3437
3438/* Condition-case handler used when reading files in insert-file-contents. */ 3438
3439/* Condition-case handler used when reading from non-regular files
3440 in insert-file-contents. */
3439 3441
3440static Lisp_Object 3442static Lisp_Object
3441read_contents_quit (Lisp_Object ignore) 3443read_non_regular_quit (Lisp_Object ignore)
3442{ 3444{
3443 return Qnil; 3445 return Qnil;
3444} 3446}
@@ -3516,10 +3518,9 @@ by calling `format-decode', which see. */)
3516 Lisp_Object p; 3518 Lisp_Object p;
3517 ptrdiff_t total = 0; 3519 ptrdiff_t total = 0;
3518 bool not_regular = 0; 3520 bool not_regular = 0;
3519 int save_errno = 0, read_errno = 0; 3521 int save_errno = 0;
3520 char read_buf[READ_BUF_SIZE]; 3522 char read_buf[READ_BUF_SIZE];
3521 struct coding_system coding; 3523 struct coding_system coding;
3522 char buffer[1 << 14];
3523 bool replace_handled = 0; 3524 bool replace_handled = 0;
3524 bool set_coding_system = 0; 3525 bool set_coding_system = 0;
3525 Lisp_Object coding_system; 3526 Lisp_Object coding_system;
@@ -3822,7 +3823,7 @@ by calling `format-decode', which see. */)
3822 { 3823 {
3823 int nread, bufpos; 3824 int nread, bufpos;
3824 3825
3825 nread = emacs_read (fd, buffer, sizeof buffer); 3826 nread = emacs_read (fd, read_buf, sizeof read_buf);
3826 if (nread < 0) 3827 if (nread < 0)
3827 error ("IO error reading %s: %s", 3828 error ("IO error reading %s: %s",
3828 SSDATA (orig_filename), emacs_strerror (errno)); 3829 SSDATA (orig_filename), emacs_strerror (errno));
@@ -3831,7 +3832,7 @@ by calling `format-decode', which see. */)
3831 3832
3832 if (CODING_REQUIRE_DETECTION (&coding)) 3833 if (CODING_REQUIRE_DETECTION (&coding))
3833 { 3834 {
3834 coding_system = detect_coding_system ((unsigned char *) buffer, 3835 coding_system = detect_coding_system ((unsigned char *) read_buf,
3835 nread, nread, 1, 0, 3836 nread, nread, 1, 0,
3836 coding_system); 3837 coding_system);
3837 setup_coding_system (coding_system, &coding); 3838 setup_coding_system (coding_system, &coding);
@@ -3847,7 +3848,7 @@ by calling `format-decode', which see. */)
3847 3848
3848 bufpos = 0; 3849 bufpos = 0;
3849 while (bufpos < nread && same_at_start < ZV_BYTE 3850 while (bufpos < nread && same_at_start < ZV_BYTE
3850 && FETCH_BYTE (same_at_start) == buffer[bufpos]) 3851 && FETCH_BYTE (same_at_start) == read_buf[bufpos])
3851 same_at_start++, bufpos++; 3852 same_at_start++, bufpos++;
3852 /* If we found a discrepancy, stop the scan. 3853 /* If we found a discrepancy, stop the scan.
3853 Otherwise loop around and scan the next bufferful. */ 3854 Otherwise loop around and scan the next bufferful. */
@@ -3881,7 +3882,7 @@ by calling `format-decode', which see. */)
3881 if (curpos == 0) 3882 if (curpos == 0)
3882 break; 3883 break;
3883 /* How much can we scan in the next step? */ 3884 /* How much can we scan in the next step? */
3884 trial = min (curpos, sizeof buffer); 3885 trial = min (curpos, sizeof read_buf);
3885 if (lseek (fd, curpos - trial, SEEK_SET) < 0) 3886 if (lseek (fd, curpos - trial, SEEK_SET) < 0)
3886 report_file_error ("Setting file position", 3887 report_file_error ("Setting file position",
3887 Fcons (orig_filename, Qnil)); 3888 Fcons (orig_filename, Qnil));
@@ -3889,7 +3890,7 @@ by calling `format-decode', which see. */)
3889 total_read = nread = 0; 3890 total_read = nread = 0;
3890 while (total_read < trial) 3891 while (total_read < trial)
3891 { 3892 {
3892 nread = emacs_read (fd, buffer + total_read, trial - total_read); 3893 nread = emacs_read (fd, read_buf + total_read, trial - total_read);
3893 if (nread < 0) 3894 if (nread < 0)
3894 error ("IO error reading %s: %s", 3895 error ("IO error reading %s: %s",
3895 SDATA (orig_filename), emacs_strerror (errno)); 3896 SDATA (orig_filename), emacs_strerror (errno));
@@ -3905,7 +3906,7 @@ by calling `format-decode', which see. */)
3905 /* Compare with same_at_start to avoid counting some buffer text 3906 /* Compare with same_at_start to avoid counting some buffer text
3906 as matching both at the file's beginning and at the end. */ 3907 as matching both at the file's beginning and at the end. */
3907 while (bufpos > 0 && same_at_end > same_at_start 3908 while (bufpos > 0 && same_at_end > same_at_start
3908 && FETCH_BYTE (same_at_end - 1) == buffer[bufpos - 1]) 3909 && FETCH_BYTE (same_at_end - 1) == read_buf[bufpos - 1])
3909 same_at_end--, bufpos--; 3910 same_at_end--, bufpos--;
3910 3911
3911 /* If we found a discrepancy, stop the scan. 3912 /* If we found a discrepancy, stop the scan.
@@ -4197,68 +4198,85 @@ by calling `format-decode', which see. */)
4197 Fcons (orig_filename, Qnil)); 4198 Fcons (orig_filename, Qnil));
4198 } 4199 }
4199 4200
4200 /* In the following loop, HOW_MUCH contains the total bytes read 4201 /* In the following loop, HOW_MUCH contains the total bytes read so
4201 so far for a regular file, and not changed for a special file. */ 4202 far for a regular file, and not changed for a special file. But,
4203 before exiting the loop, it is set to a negative value if I/O
4204 error occurs. */
4202 how_much = 0; 4205 how_much = 0;
4203 4206
4204 /* Total bytes inserted. */ 4207 /* Total bytes inserted. */
4205 inserted = 0; 4208 inserted = 0;
4206 4209
4207 /* Here we don't do code conversion in the loop. It is done by 4210 /* Here, we don't do code conversion in the loop. It is done by
4208 decode_coding_gap after all data are read into the buffer, or 4211 decode_coding_gap after all data are read into the buffer. */
4209 reading loop is interrupted with quit or due to I/O error. */ 4212 {
4213 ptrdiff_t gap_size = GAP_SIZE;
4210 4214
4211 while (how_much < total) 4215 while (how_much < total)
4212 { 4216 {
4213 ptrdiff_t nread, maxread = min (total - how_much, READ_BUF_SIZE); 4217 /* try is reserved in some compilers (Microsoft C) */
4214 Lisp_Object result; 4218 ptrdiff_t trytry = min (total - how_much, READ_BUF_SIZE);
4215 4219 ptrdiff_t this;
4216 /* For a special file, gap is enlarged as we read,
4217 so GAP_SIZE should be checked every time. */
4218 if (not_regular && (GAP_SIZE < maxread))
4219 make_gap (maxread - GAP_SIZE);
4220
4221 /* Read from the file, capturing `quit'. */
4222 result = internal_condition_case_1
4223 (read_contents,
4224 make_save_value ("iii", (ptrdiff_t) fd, inserted, maxread),
4225 Qerror, read_contents_quit);
4226 if (NILP (result))
4227 {
4228 /* Quit is signaled. End the loop and arrange
4229 real quit after decoding the text we read. */
4230 read_quit = 1;
4231 break;
4232 }
4233 nread = XINT (result);
4234 if (nread <= 0)
4235 {
4236 /* End of file or I/O error. End the loop and
4237 save error code in case of I/O error. */
4238 if (nread < 0)
4239 read_errno = errno;
4240 break;
4241 }
4242 4220
4243 /* Adjust gap and end positions. */ 4221 if (not_regular)
4244 GAP_SIZE -= nread; 4222 {
4245 GPT += nread; 4223 Lisp_Object nbytes;
4246 ZV += nread; 4224
4247 Z += nread; 4225 /* Maybe make more room. */
4248 GPT_BYTE += nread; 4226 if (gap_size < trytry)
4249 ZV_BYTE += nread; 4227 {
4250 Z_BYTE += nread; 4228 make_gap (trytry - gap_size);
4251 if (GAP_SIZE > 0) 4229 gap_size = GAP_SIZE - inserted;
4252 *(GPT_ADDR) = 0; 4230 }
4253 4231
4254 /* For a regular file, where TOTAL is the real size, count HOW_MUCH to 4232 /* Read from the file, capturing `quit'. When an
4255 compare with it. For a special file, where TOTAL is just a buffer 4233 error occurs, end the loop, and arrange for a quit
4256 size, don't bother counting in HOW_MUCH, but always accumulate the 4234 to be signaled after decoding the text we read. */
4257 number of bytes read in INSERTED. */ 4235 nbytes = internal_condition_case_1
4258 if (!not_regular) 4236 (read_non_regular,
4259 how_much += nread; 4237 make_save_value ("iii", (ptrdiff_t) fd, inserted, trytry),
4260 inserted += nread; 4238 Qerror, read_non_regular_quit);
4261 } 4239
4240 if (NILP (nbytes))
4241 {
4242 read_quit = 1;
4243 break;
4244 }
4245
4246 this = XINT (nbytes);
4247 }
4248 else
4249 {
4250 /* Allow quitting out of the actual I/O. We don't make text
4251 part of the buffer until all the reading is done, so a C-g
4252 here doesn't do any harm. */
4253 immediate_quit = 1;
4254 QUIT;
4255 this = emacs_read (fd,
4256 ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE
4257 + inserted),
4258 trytry);
4259 immediate_quit = 0;
4260 }
4261
4262 if (this <= 0)
4263 {
4264 how_much = this;
4265 break;
4266 }
4267
4268 gap_size -= this;
4269
4270 /* For a regular file, where TOTAL is the real size,
4271 count HOW_MUCH to compare with it.
4272 For a special file, where TOTAL is just a buffer size,
4273 so don't bother counting in HOW_MUCH.
4274 (INSERTED is where we count the number of characters inserted.) */
4275 if (! not_regular)
4276 how_much += this;
4277 inserted += this;
4278 }
4279 }
4262 4280
4263 /* Now we have either read all the file data into the gap, 4281 /* Now we have either read all the file data into the gap,
4264 or stop reading on I/O error or quit. If nothing was 4282 or stop reading on I/O error or quit. If nothing was
@@ -4280,6 +4298,23 @@ by calling `format-decode', which see. */)
4280 /* Discard the unwind protect for closing the file. */ 4298 /* Discard the unwind protect for closing the file. */
4281 specpdl_ptr--; 4299 specpdl_ptr--;
4282 4300
4301 if (how_much < 0)
4302 error ("IO error reading %s: %s",
4303 SDATA (orig_filename), emacs_strerror (errno));
4304
4305 /* Make the text read part of the buffer. */
4306 GAP_SIZE -= inserted;
4307 GPT += inserted;
4308 GPT_BYTE += inserted;
4309 ZV += inserted;
4310 ZV_BYTE += inserted;
4311 Z += inserted;
4312 Z_BYTE += inserted;
4313
4314 if (GAP_SIZE > 0)
4315 /* Put an anchor to ensure multi-byte form ends at gap. */
4316 *GPT_ADDR = 0;
4317
4283 notfound: 4318 notfound:
4284 4319
4285 if (NILP (coding_system)) 4320 if (NILP (coding_system))
@@ -4568,15 +4603,10 @@ by calling `format-decode', which see. */)
4568 report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); 4603 report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
4569 } 4604 }
4570 4605
4571 /* There was an error reading file. */
4572 if (read_errno)
4573 error ("IO error reading %s: %s",
4574 SDATA (orig_filename), emacs_strerror (read_errno));
4575
4576 /* Quit was signaled. */
4577 if (read_quit) 4606 if (read_quit)
4578 Fsignal (Qquit, Qnil); 4607 Fsignal (Qquit, Qnil);
4579 4608
4609 /* Retval needs to be dealt with in all cases consistently. */
4580 if (NILP (val)) 4610 if (NILP (val))
4581 val = list2 (orig_filename, make_number (inserted)); 4611 val = list2 (orig_filename, make_number (inserted));
4582 4612
diff --git a/src/w32.c b/src/w32.c
index be58dc5cd53..d014609076e 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -4868,51 +4868,57 @@ acl_set_file (const char *fname, acl_type_t type, acl_t acl)
4868 4868
4869 e = errno; 4869 e = errno;
4870 errno = 0; 4870 errno = 0;
4871 set_file_security ((char *)fname, flags, (PSECURITY_DESCRIPTOR)acl); 4871 if (!set_file_security ((char *)fname, flags, (PSECURITY_DESCRIPTOR)acl))
4872 err = GetLastError ();
4873 if (st)
4874 { 4872 {
4875 if (st >= 2) 4873 err = GetLastError ();
4876 restore_privilege (&old2);
4877 restore_privilege (&old1);
4878 revert_to_self ();
4879 }
4880
4881 if (errno == ENOTSUP)
4882 ;
4883 else if (err == ERROR_SUCCESS)
4884 {
4885 retval = 0;
4886 errno = e;
4887 }
4888 else if (err == ERROR_INVALID_OWNER || err == ERROR_NOT_ALL_ASSIGNED
4889 || err == ERROR_ACCESS_DENIED)
4890 {
4891 /* Maybe the requested ACL and the one the file already has are
4892 identical, in which case we can silently ignore the
4893 failure. (And no, Windows doesn't.) */
4894 acl_t current_acl = acl_get_file (fname, ACL_TYPE_ACCESS);
4895 4874
4896 errno = EPERM; 4875 if (errno == ENOTSUP)
4897 if (current_acl) 4876 ;
4877 else if (err == ERROR_INVALID_OWNER
4878 || err == ERROR_NOT_ALL_ASSIGNED
4879 || err == ERROR_ACCESS_DENIED)
4898 { 4880 {
4899 char *acl_from = acl_to_text (current_acl, NULL); 4881 /* Maybe the requested ACL and the one the file already has
4900 char *acl_to = acl_to_text (acl, NULL); 4882 are identical, in which case we can silently ignore the
4883 failure. (And no, Windows doesn't.) */
4884 acl_t current_acl = acl_get_file (fname, ACL_TYPE_ACCESS);
4901 4885
4902 if (acl_from && acl_to && xstrcasecmp (acl_from, acl_to) == 0) 4886 errno = EPERM;
4887 if (current_acl)
4903 { 4888 {
4904 retval = 0; 4889 char *acl_from = acl_to_text (current_acl, NULL);
4905 errno = e; 4890 char *acl_to = acl_to_text (acl, NULL);
4891
4892 if (acl_from && acl_to && xstrcasecmp (acl_from, acl_to) == 0)
4893 {
4894 retval = 0;
4895 errno = e;
4896 }
4897 if (acl_from)
4898 acl_free (acl_from);
4899 if (acl_to)
4900 acl_free (acl_to);
4901 acl_free (current_acl);
4906 } 4902 }
4907 if (acl_from)
4908 acl_free (acl_from);
4909 if (acl_to)
4910 acl_free (acl_to);
4911 acl_free (current_acl);
4912 } 4903 }
4904 else if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND)
4905 errno = ENOENT;
4906 else
4907 errno = EACCES;
4908 }
4909 else
4910 {
4911 retval = 0;
4912 errno = e;
4913 }
4914
4915 if (st)
4916 {
4917 if (st >= 2)
4918 restore_privilege (&old2);
4919 restore_privilege (&old1);
4920 revert_to_self ();
4913 } 4921 }
4914 else if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND)
4915 errno = ENOENT;
4916 4922
4917 return retval; 4923 return retval;
4918} 4924}