commit/XEmacs: kehoea: Accept GNU's UNIVERSAL argument to #'format-time-string.
12 years, 3 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/changeset/aa5f38ecb804/
changeset: aa5f38ecb804
user: kehoea
date: 2012-09-16 22:43:21
summary: Accept GNU's UNIVERSAL argument to #'format-time-string.
src/ChangeLog addition:
2012-09-16 Aidan Kehoe <kehoea(a)parhasard.net>
* editfns.c (Fformat_time_string):
Accept GNU's UNIVERSAL argument, which means we call gmtime()
instead of localtime(). Thanks for the report of org-mode
incompatibility, Matsl!
affected #: 2 files
diff -r 0eb4e96fd261faa9079b4b6fef400815d660883a -r aa5f38ecb804ee655969c0f617ff5c50415ae3f7 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2012-09-16 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * editfns.c (Fformat_time_string):
+ Accept GNU's UNIVERSAL argument, which means we call gmtime()
+ instead of localtime(). Thanks for the report of org-mode
+ incompatibility, Matsl!
+
2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
* file-coding.c:
diff -r 0eb4e96fd261faa9079b4b6fef400815d660883a -r aa5f38ecb804ee655969c0f617ff5c50415ae3f7 src/editfns.c
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -998,11 +998,13 @@
static long difftm (const struct tm *a, const struct tm *b);
-DEFUN ("format-time-string", Fformat_time_string, 1, 2, 0, /*
+DEFUN ("format-time-string", Fformat_time_string, 1, 3, 0, /*
Use FORMAT-STRING to format the time TIME.
TIME is specified as (HIGH LOW . IGNORED) or (HIGH . LOW), as from
`current-time' and `file-attributes'. If TIME is not specified it
defaults to the current time.
+The third, optional, argument UNIVERSAL, if non-nil, means describe TIME
+as Universal Time; nil means describe TIME in the local time zone.
FORMAT-STRING may contain %-sequences to substitute parts of the time.
%a is replaced by the abbreviated name of the day of week.
%A is replaced by the full name of the day of week.
@@ -1047,7 +1049,7 @@
The number of options reflects the `strftime' function.
*/
- (format_string, time_))
+ (format_string, time_, universal))
{
time_t value;
Bytecount size;
@@ -1065,7 +1067,7 @@
Extbyte *buf = alloca_extbytes (size);
Extbyte *formext;
/* make a copy of the static buffer returned by localtime() */
- struct tm tm = *localtime (&value);
+ struct tm tm = NILP (universal) ? *localtime (&value) : *gmtime (&value);
*buf = 1;
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/xemacs-packages: 3 new changesets
12 years, 3 months
Bitbucket
3 new commits in xemacs-packages:
https://bitbucket.org/xemacs/xemacs-packages/changeset/d6be6eda1fdb/
changeset: d6be6eda1fdb
user: Norbert Koch
date: 2012-09-11 09:08:26
summary: Update cc-mode
affected #: 1 file
diff -r cb2797da16590d16e75c3cb00e2265a1a3503fbf -r d6be6eda1fdba01c41b990b00fa726b174555e59 .hgsubstate
--- a/.hgsubstate
+++ b/.hgsubstate
@@ -17,7 +17,7 @@
da4e7d4a51c502e5ac05a224cb756f382f0ba4d7 xemacs-packages/c-support
11074b3808d1e349f3fddb3c4d50f8be7c0f859e xemacs-packages/calc
7524e4fb9de45d77812090a724fac4ebd7549d6e xemacs-packages/calendar
-7555921b9b7ccb9ae5c43024699be78ecfacd136 xemacs-packages/cc-mode
+6bf70f1270efe5b5d6ec57d59153918ef0c8a145 xemacs-packages/cc-mode
a7ae1cfb2376bcd32617c1c88afe08872b11d298 xemacs-packages/cedet-common
87dd21fac17ea98219267b1378b4696698d6c4ff xemacs-packages/clearcase
e18acdbfcd36295d052cd56fa2e6d78c68b4b7d4 xemacs-packages/cogre
https://bitbucket.org/xemacs/xemacs-packages/changeset/2483cbfd3424/
changeset: 2483cbfd3424
user: Norbert Koch
date: 2012-09-11 09:08:45
summary: XEmacs Package Release
affected #: 1 file
diff -r d6be6eda1fdba01c41b990b00fa726b174555e59 -r 2483cbfd34248dd18a974dc8ce48c3f6223a3c76 ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-11 Norbert Koch <viteno(a)xemacs.org>
+
+ * Packages released: cc-mode.
+
2012-09-03 Norbert Koch <viteno(a)xemacs.org>
* Packages released: cc-mode, prog-modes.
https://bitbucket.org/xemacs/xemacs-packages/changeset/3d6f3ce1bd1b/
changeset: 3d6f3ce1bd1b
user: Norbert Koch
date: 2012-09-11 09:13:39
summary: pre-release cc-mode
affected #: 1 file
diff -r 2483cbfd34248dd18a974dc8ce48c3f6223a3c76 -r 3d6f3ce1bd1b1464ca0bf6413ecbbef7676f057f .hgsubstate
--- a/.hgsubstate
+++ b/.hgsubstate
@@ -17,7 +17,7 @@
da4e7d4a51c502e5ac05a224cb756f382f0ba4d7 xemacs-packages/c-support
11074b3808d1e349f3fddb3c4d50f8be7c0f859e xemacs-packages/calc
7524e4fb9de45d77812090a724fac4ebd7549d6e xemacs-packages/calendar
-6bf70f1270efe5b5d6ec57d59153918ef0c8a145 xemacs-packages/cc-mode
+40708b7098aaf466959a77d8a94d44d9b4a54754 xemacs-packages/cc-mode
a7ae1cfb2376bcd32617c1c88afe08872b11d298 xemacs-packages/cedet-common
87dd21fac17ea98219267b1378b4696698d6c4ff xemacs-packages/clearcase
e18acdbfcd36295d052cd56fa2e6d78c68b4b7d4 xemacs-packages/cogre
Repository URL: https://bitbucket.org/xemacs/xemacs-packages/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/cc-mode: 2 new changesets
12 years, 3 months
Bitbucket
2 new commits in cc-mode:
https://bitbucket.org/xemacs/cc-mode/changeset/a9aff1813e2a/
changeset: a9aff1813e2a
user: Norbert Koch
date: 2012-09-11 09:08:44
summary: XEmacs Package Release 1.57
affected #: 2 files
diff -r 6bf70f1270efe5b5d6ec57d59153918ef0c8a145 -r a9aff1813e2a4aa3d8af1ae40b69bcaf033f7905 ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-11 Norbert Koch <viteno(a)xemacs.org>
+
+ * Makefile (VERSION): XEmacs package 1.57 released.
+
2012-09-03 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.56 released.
diff -r 6bf70f1270efe5b5d6ec57d59153918ef0c8a145 -r a9aff1813e2a4aa3d8af1ae40b69bcaf033f7905 Makefile
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-VERSION = 1.56
+VERSION = 1.57
AUTHOR_VERSION = 5.32.2
MAINTAINER = Alan Mackenzie <bug-cc-mode(a)gnu.org>
PACKAGE = cc-mode
https://bitbucket.org/xemacs/cc-mode/changeset/40708b7098aa/
changeset: 40708b7098aa
user: Norbert Koch
date: 2012-09-11 09:08:45
summary: Added tag cc-mode-1_57 for changeset a9aff1813e2a
affected #: 1 file
diff -r a9aff1813e2a4aa3d8af1ae40b69bcaf033f7905 -r 40708b7098aaf466959a77d8a94d44d9b4a54754 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -89,3 +89,4 @@
f1a6c0e647399eba8c3511db89520f0efc63d535 cc-mode-1_54
c6a1f4bc808ef2c7d08ba5147537e99b40c78ce4 cc-mode-1_55
2475272d8bae991446e6b5fe927fb9a489b6df5d cc-mode-1_56
+a9aff1813e2a4aa3d8af1ae40b69bcaf033f7905 cc-mode-1_57
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/cc-mode: acm: Correct the handling of two c-state-cache state variables.
12 years, 3 months
Bitbucket
1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/changeset/6bf70f1270ef/
changeset: 6bf70f1270ef
user: acm
date: 2012-09-09 13:14:04
summary: Correct the handling of two c-state-cache state variables.
cc-engine.el (c-state-cache-init): Initialise
c-state-semi-nonlit-pos-cache\(-limit\)? properly.
(c-record-parse-state-state): record
c-state-semi-nonlit-pos-cache\(-limit\)?.
affected #: 1 file
diff -r 7555921b9b7ccb9ae5c43024699be78ecfacd136 -r 6bf70f1270efe5b5d6ec57d59153918ef0c8a145 cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -3094,6 +3094,8 @@
c-state-cache-good-pos 1
c-state-nonlit-pos-cache nil
c-state-nonlit-pos-cache-limit 1
+ c-state-semi-nonlit-pos-cache nil
+ c-state-semi-nonlit-pos-cache-limit 1
c-state-brace-pair-desert nil
c-state-point-min 1
c-state-point-min-lit-type nil
@@ -3363,6 +3365,8 @@
c-state-cache-good-pos
c-state-nonlit-pos-cache
c-state-nonlit-pos-cache-limit
+ c-state-semi-nonlit-pos-cache
+ c-state-semi-nonlit-pos-cache-limit
c-state-brace-pair-desert
c-state-point-min
c-state-point-min-lit-type
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] #'delete-trailing-whitespace needs to work when the region is inactive, too
12 years, 3 months
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1347118428 -3600
# Node ID 0eb4e96fd261faa9079b4b6fef400815d660883a
# Parent 98f762d06c5fb95ba6a6d1883e1cf65f7aca8f13
#'delete-trailing-whitespace needs to work when the region is inactive, too
lisp/ChangeLog addition:
Update its interactive spec to work correctly in XEmacs.
diff -r 98f762d06c5f -r 0eb4e96fd261 lisp/ChangeLog
--- a/lisp/ChangeLog Sat Sep 08 13:34:20 2012 +0100
+++ b/lisp/ChangeLog Sat Sep 08 16:33:48 2012 +0100
@@ -5,6 +5,7 @@
* simple.el (delete-trailing-whitespace): New.
Import this function and an associated variable from GNU, thank
you GNU.
+ Update its interactive spec to work correctly in XEmacs.
2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
diff -r 98f762d06c5f -r 0eb4e96fd261 lisp/simple.el
--- a/lisp/simple.el Sat Sep 08 13:34:20 2012 +0100
+++ b/lisp/simple.el Sat Sep 08 16:33:48 2012 +0100
@@ -391,8 +391,13 @@
interactively with the mark inactive, or called from Lisp with
END nil), it also deletes all trailing lines at the end of the
buffer if the variable `delete-trailing-lines' is non-nil."
- ;; XEmacs; "*r" instead of re-implementing it.
- (interactive "*r")
+ (interactive (progn
+ (barf-if-buffer-read-only)
+ (if (if zmacs-regions
+ zmacs-region-active-p
+ (eq (marker-buffer (mark-marker t)) (current-buffer)))
+ (list (region-beginning) (region-end))
+ (list nil nil))))
(save-match-data
(save-excursion
(let ((end-marker (copy-marker (or end (point-max))))
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/XEmacs: kehoea: #'delete-trailing-whitespace needs to work when the region is inactive, too
12 years, 3 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/changeset/0eb4e96fd261/
changeset: 0eb4e96fd261
user: kehoea
date: 2012-09-08 17:33:48
summary: #'delete-trailing-whitespace needs to work when the region is inactive, too
lisp/ChangeLog addition:
Update its interactive spec to work correctly in XEmacs.
affected #: 2 files
diff -r 98f762d06c5fb95ba6a6d1883e1cf65f7aca8f13 -r 0eb4e96fd261faa9079b4b6fef400815d660883a lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -5,6 +5,7 @@
* simple.el (delete-trailing-whitespace): New.
Import this function and an associated variable from GNU, thank
you GNU.
+ Update its interactive spec to work correctly in XEmacs.
2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
diff -r 98f762d06c5fb95ba6a6d1883e1cf65f7aca8f13 -r 0eb4e96fd261faa9079b4b6fef400815d660883a lisp/simple.el
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -391,8 +391,13 @@
interactively with the mark inactive, or called from Lisp with
END nil), it also deletes all trailing lines at the end of the
buffer if the variable `delete-trailing-lines' is non-nil."
- ;; XEmacs; "*r" instead of re-implementing it.
- (interactive "*r")
+ (interactive (progn
+ (barf-if-buffer-read-only)
+ (if (if zmacs-regions
+ zmacs-region-active-p
+ (eq (marker-buffer (mark-marker t)) (current-buffer)))
+ (list (region-beginning) (region-end))
+ (list nil nil))))
(save-match-data
(save-excursion
(let ((end-marker (copy-marker (or end (point-max))))
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Import GNU's #'delete-trailing-whitespace, thank you GNU.
12 years, 3 months
Aidan Kehoe
Mats tells me this is needed for org-mode, and it’s a useful feature
beyond that.
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1347107660 -3600
# Node ID 98f762d06c5fb95ba6a6d1883e1cf65f7aca8f13
# Parent dae33b5feffeee270840946d709b40dfae7e4689
Import GNU's #'delete-trailing-whitespace, thank you GNU.
lisp/ChangeLog addition:
2012-09-08 Aidan Kehoe <kehoea(a)parhasard.net>
* simple.el:
* simple.el (delete-trailing-lines): New.
* simple.el (delete-trailing-whitespace): New.
Import this function and an associated variable from GNU, thank
you GNU.
diff -r dae33b5feffe -r 98f762d06c5f lisp/ChangeLog
--- a/lisp/ChangeLog Fri Sep 07 22:06:01 2012 +0100
+++ b/lisp/ChangeLog Sat Sep 08 13:34:20 2012 +0100
@@ -1,3 +1,11 @@
+2012-09-08 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * simple.el:
+ * simple.el (delete-trailing-lines): New.
+ * simple.el (delete-trailing-whitespace): New.
+ Import this function and an associated variable from GNU, thank
+ you GNU.
+
2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
* files.el:
diff -r dae33b5feffe -r 98f762d06c5f lisp/simple.el
--- a/lisp/simple.el Fri Sep 07 22:06:01 2012 +0100
+++ b/lisp/simple.el Sat Sep 08 13:34:20 2012 +0100
@@ -369,6 +369,54 @@
(if (looking-at "^[ \t]*\n\\'")
(delete-region (point) (point-max)))))
+(defcustom delete-trailing-lines t
+ "If non-nil, \\[delete-trailing-whitespace] deletes trailing lines.
+Trailing lines are deleted only if `delete-trailing-whitespace'
+is called on the entire buffer (rather than an active region)."
+:type 'boolean
+:group 'editing)
+ ; :version "24.2")
+
+(defun delete-trailing-whitespace (&optional start end)
+ "Delete trailing whitespace between START and END.
+If called interactively, START and END are the start/end of the
+region if the mark is active, or of the buffer's accessible
+portion if the mark is inactive.
+
+This command deletes whitespace characters after the last
+non-whitespace character in each line between START and END. It
+does not consider formfeed characters to be whitespace.
+
+If this command acts on the entire buffer (i.e. if called
+interactively with the mark inactive, or called from Lisp with
+END nil), it also deletes all trailing lines at the end of the
+buffer if the variable `delete-trailing-lines' is non-nil."
+ ;; XEmacs; "*r" instead of re-implementing it.
+ (interactive "*r")
+ (save-match-data
+ (save-excursion
+ (let ((end-marker (copy-marker (or end (point-max))))
+ (start (or start (point-min))))
+ (goto-char start)
+ (while (re-search-forward "\\s-$" end-marker t)
+ (skip-syntax-backward "-" (line-beginning-position))
+ ;; Don't delete formfeeds, even if they are considered whitespace.
+ ;; XEmacs; #'looking-at-p not (yet) available
+ (if (save-match-data (looking-at ".*\f"))
+ (goto-char (match-end 0)))
+ (delete-region (point) (match-end 0)))
+ ;; Delete trailing empty lines.
+ (goto-char end-marker)
+ (when (and (not end)
+ delete-trailing-lines
+ ;; Really the end of buffer.
+ (save-restriction (widen) (eobp))
+ (<= (skip-chars-backward "\n") -2))
+ (delete-region (1+ (point)) end-marker))
+ (set-marker end-marker nil))))
+ ;; Return nil for the benefit of `write-file-functions'.
+ nil)
+
(defun back-to-indentation ()
"Move point to the first non-whitespace character on this line."
;; XEmacs change
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/XEmacs: kehoea: Import GNU's #'delete-trailing-whitespace, thank you GNU.
12 years, 3 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/changeset/98f762d06c5f/
changeset: 98f762d06c5f
user: kehoea
date: 2012-09-08 14:34:20
summary: Import GNU's #'delete-trailing-whitespace, thank you GNU.
lisp/ChangeLog addition:
2012-09-08 Aidan Kehoe <kehoea(a)parhasard.net>
* simple.el:
* simple.el (delete-trailing-lines): New.
* simple.el (delete-trailing-whitespace): New.
Import this function and an associated variable from GNU, thank
you GNU.
affected #: 2 files
diff -r dae33b5feffeee270840946d709b40dfae7e4689 -r 98f762d06c5fb95ba6a6d1883e1cf65f7aca8f13 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2012-09-08 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * simple.el:
+ * simple.el (delete-trailing-lines): New.
+ * simple.el (delete-trailing-whitespace): New.
+ Import this function and an associated variable from GNU, thank
+ you GNU.
+
2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
* files.el:
diff -r dae33b5feffeee270840946d709b40dfae7e4689 -r 98f762d06c5fb95ba6a6d1883e1cf65f7aca8f13 lisp/simple.el
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -369,6 +369,54 @@
(if (looking-at "^[ \t]*\n\\'")
(delete-region (point) (point-max)))))
+(defcustom delete-trailing-lines t
+ "If non-nil, \\[delete-trailing-whitespace] deletes trailing lines.
+Trailing lines are deleted only if `delete-trailing-whitespace'
+is called on the entire buffer (rather than an active region)."
+:type 'boolean
+:group 'editing)
+ ; :version "24.2")
+
+(defun delete-trailing-whitespace (&optional start end)
+ "Delete trailing whitespace between START and END.
+If called interactively, START and END are the start/end of the
+region if the mark is active, or of the buffer's accessible
+portion if the mark is inactive.
+
+This command deletes whitespace characters after the last
+non-whitespace character in each line between START and END. It
+does not consider formfeed characters to be whitespace.
+
+If this command acts on the entire buffer (i.e. if called
+interactively with the mark inactive, or called from Lisp with
+END nil), it also deletes all trailing lines at the end of the
+buffer if the variable `delete-trailing-lines' is non-nil."
+ ;; XEmacs; "*r" instead of re-implementing it.
+ (interactive "*r")
+ (save-match-data
+ (save-excursion
+ (let ((end-marker (copy-marker (or end (point-max))))
+ (start (or start (point-min))))
+ (goto-char start)
+ (while (re-search-forward "\\s-$" end-marker t)
+ (skip-syntax-backward "-" (line-beginning-position))
+ ;; Don't delete formfeeds, even if they are considered whitespace.
+ ;; XEmacs; #'looking-at-p not (yet) available
+ (if (save-match-data (looking-at ".*\f"))
+ (goto-char (match-end 0)))
+ (delete-region (point) (match-end 0)))
+ ;; Delete trailing empty lines.
+ (goto-char end-marker)
+ (when (and (not end)
+ delete-trailing-lines
+ ;; Really the end of buffer.
+ (save-restriction (widen) (eobp))
+ (<= (skip-chars-backward "\n") -2))
+ (delete-region (1+ (point)) end-marker))
+ (set-marker end-marker nil))))
+ ;; Return nil for the benefit of `write-file-functions'.
+ nil)
+
(defun back-to-indentation ()
"Move point to the first non-whitespace character on this line."
;; XEmacs change
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Unify #'find-coding-system-magic-cookie-in-file, look_for_coding_system_magic_cookie()
12 years, 3 months
Aidan Kehoe
GNU have better coding-system-sensing infrastructure that needs porting, but
this is an improvement independent of that.
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1347051961 -3600
# Node ID dae33b5feffeee270840946d709b40dfae7e4689
# Parent 4af5a3435c94358798bcd2e56c51eaebbc5f36d2
Unify #'find-coding-system-magic-cookie-in-file, look_for_coding_system_magic_cookie()
src/ChangeLog addition:
2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
* file-coding.c:
* file-coding.c (snarf_coding_system):
Take a new parameter, FIND_CODING_SYSTEM_P, which indicates that
find_coding_system() should be called.
* file-coding.c (look_for_coding_system_magic_cookie):
* file-coding.c (determine_real_coding_system):
* file-coding.c (undecided_convert):
Use this parameter.
* file-coding.c (Ffind_coding_system_magic_cookie_in_file):
New, moved from files.el, so we can use
look_for_coding_system_magic_cookie's implementation.
* file-coding.c (syms_of_file_coding):
Make Ffind_coding_system_magic_cookie_in_file available.
lisp/ChangeLog addition:
2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
* files.el:
* files.el (find-coding-system-magic-cookie-in-file):
Removed. Move this to C, so we can use
look_for_coding_system_magic_cookie().
diff -r 4af5a3435c94 -r dae33b5feffe lisp/ChangeLog
--- a/lisp/ChangeLog Wed Sep 05 20:37:58 2012 +0100
+++ b/lisp/ChangeLog Fri Sep 07 22:06:01 2012 +0100
@@ -1,3 +1,10 @@
+2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * files.el:
+ * files.el (find-coding-system-magic-cookie-in-file):
+ Removed. Move this to C, so we can use
+ look_for_coding_system_magic_cookie().
+
2012-08-02 Stephen J. Turnbull <stephen(a)xemacs.org>
* XEmacs 21.5.32 "habanero" is released.
diff -r 4af5a3435c94 -r dae33b5feffe lisp/files.el
--- a/lisp/files.el Wed Sep 05 20:37:58 2012 +0100
+++ b/lisp/files.el Fri Sep 07 22:06:01 2012 +0100
@@ -2126,52 +2126,6 @@
;; Ordinary variable, really set it.
(t (make-local-variable var)
(set var val))))
-
-(defun find-coding-system-magic-cookie-in-file (file)
- "Look for the coding-system magic cookie in FILE.
-The coding-system magic cookie is either the local variable specification
--*- ... coding: ... -*- on the first line, or the exact string
-\";;;###coding system: \" somewhere within the first 3000 characters
-of the file. If found, the coding system name (as a string) is returned;
-otherwise nil is returned. Note that it is extremely unlikely that
-either such string would occur coincidentally as the result of encoding
-some characters in a non-ASCII charset, and that the spaces make it
-even less likely since the space character is not a valid octet in any
-ISO 2022 encoding of most non-ASCII charsets."
- (save-excursion
- (with-temp-buffer
- (let ((coding-system-for-read 'raw-text))
- (insert-file-contents file nil 0 3000))
- (goto-char (point-min))
- (or (and (looking-at
- "^[^\n]*-\\*-[^\n]*coding: \\([^ \t\n;]+\\)[^\n]*-\\*-")
- (buffer-substring (match-beginning 1) (match-end 1)))
- ;; (save-excursion
- ;; (let (start end)
- ;; (and (re-search-forward "^;+[ \t]*Local Variables:" nil t)
- ;; (setq start (match-end 0))
- ;; (re-search-forward "\n;+[ \t]*End:")
- ;; (setq end (match-beginning 0))
- ;; (save-restriction
- ;; (narrow-to-region start end)
- ;; (goto-char start)
- ;; (re-search-forward "^;;; coding: \\([^\n]+\\)$" nil t)
- ;; )
- ;; (let ((codesys
- ;; (intern (buffer-substring
- ;; (match-beginning 1)(match-end 1)))))
- ;; (if (find-coding-system codesys) codesys))
- ;; )))
- (let ((case-fold-search nil))
- (if (search-forward
- ";;;###coding system: " (+ (point-min) 3000) t)
- (let ((start (point))
- (end (progn
- (skip-chars-forward "^ \t\n\r")
- (point))))
- (if (> end start) (buffer-substring start end))
- )))
- ))))
(defcustom change-major-mode-with-file-name t
diff -r 4af5a3435c94 -r dae33b5feffe src/ChangeLog
--- a/src/ChangeLog Wed Sep 05 20:37:58 2012 +0100
+++ b/src/ChangeLog Fri Sep 07 22:06:01 2012 +0100
@@ -1,3 +1,19 @@
+2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * file-coding.c:
+ * file-coding.c (snarf_coding_system):
+ Take a new parameter, FIND_CODING_SYSTEM_P, which indicates that
+ find_coding_system() should be called.
+ * file-coding.c (look_for_coding_system_magic_cookie):
+ * file-coding.c (determine_real_coding_system):
+ * file-coding.c (undecided_convert):
+ Use this parameter.
+ * file-coding.c (Ffind_coding_system_magic_cookie_in_file):
+ New, moved from files.el, so we can use
+ look_for_coding_system_magic_cookie's implementation.
+ * file-coding.c (syms_of_file_coding):
+ Make Ffind_coding_system_magic_cookie_in_file available.
+
2012-09-05 Aidan Kehoe <kehoea(a)parhasard.net>
* keymap.c:
diff -r 4af5a3435c94 -r dae33b5feffe src/file-coding.c
--- a/src/file-coding.c Wed Sep 05 20:37:58 2012 +0100
+++ b/src/file-coding.c Fri Sep 07 22:06:01 2012 +0100
@@ -79,6 +79,7 @@
#include "extents.h"
#include "rangetab.h"
#include "chartab.h"
+#include "sysfile.h"
#ifdef HAVE_ZLIB
#include "zlib.h"
@@ -3674,7 +3675,8 @@
blanks). If found, return it, otherwise nil. */
static Lisp_Object
-snarf_coding_system (const UExtbyte *p, Bytecount len)
+snarf_coding_system (const UExtbyte *p, Bytecount len,
+ Boolint find_coding_system_p)
{
Bytecount n;
UExtbyte *name;
@@ -3698,7 +3700,16 @@
name[n] = '\0';
/* This call to intern_istring() is OK because we already verified that
there are only ASCII characters in the string */
- return find_coding_system_for_text_file (intern_istring ((Ibyte *) name), 0);
+ if (find_coding_system_p)
+ {
+ return
+ find_coding_system_for_text_file (intern_istring ((Ibyte *) name),
+ 0);
+ }
+ else
+ {
+ return build_ascstring ((const Ascbyte *) name);
+ }
}
return Qnil;
@@ -3725,11 +3736,9 @@
return Qnil;
}
-/* #### This duplicates code in `find-coding-system-magic-cookie-in-file'
- in files.el. Look into combining them. */
-
static Lisp_Object
-look_for_coding_system_magic_cookie (const UExtbyte *data, Bytecount len)
+look_for_coding_system_magic_cookie (const UExtbyte *data, Bytecount len,
+ Boolint find_coding_system_p)
{
const UExtbyte *p;
const UExtbyte *scan_end;
@@ -3767,7 +3776,8 @@
*(p-1) == ';')))
{
p += LENGTH ("coding:");
- return snarf_coding_system (p, suffix - p);
+ return snarf_coding_system (p, suffix - p,
+ find_coding_system_p);
break;
}
break;
@@ -3792,7 +3802,7 @@
suffix = p;
while (suffix < scan_end && !isspace (*suffix))
suffix++;
- return snarf_coding_system (p, suffix - p);
+ return snarf_coding_system (p, suffix - p, find_coding_system_p);
}
}
@@ -3807,7 +3817,8 @@
make_opaque_ptr (st));
UExtbyte buf[4096];
Bytecount nread = Lstream_read (stream, buf, sizeof (buf));
- Lisp_Object coding_system = look_for_coding_system_magic_cookie (buf, nread);
+ Lisp_Object coding_system
+ = look_for_coding_system_magic_cookie (buf, nread, 1);
if (NILP (coding_system))
{
@@ -3971,7 +3982,7 @@
/* #### This is cheesy. What we really ought to do is buffer
up a certain minimum amount of data to get a better result.
*/
- data->actual = look_for_coding_system_magic_cookie (src, n);
+ data->actual = look_for_coding_system_magic_cookie (src, n, 1);
if (NILP (data->actual))
{
/* #### This is cheesy. What we really ought to do is buffer
@@ -4216,6 +4227,50 @@
return val;
}
+DEFUN ("find-coding-system-magic-cookie-in-file",
+ Ffind_coding_system_magic_cookie_in_file, 1, 1, 0, /*
+Look for the coding-system magic cookie in FILENAME.
+The coding-system magic cookie is either the local variable specification
+-*- ... coding: ... -*- on the first line, or the exact string
+\";;;###coding system: \" somewhere within the first 3000 characters
+of the file. If found, the coding system name (as a string) is returned;
+otherwise nil is returned. Note that it is extremely unlikely that
+either such string would occur coincidentally as the result of encoding
+some characters in a non-ASCII charset, and that the spaces make it
+even less likely since the space character is not a valid octet in any
+ISO 2022 encoding of most non-ASCII charsets.
+*/
+ (filename))
+{
+ Lisp_Object lstream;
+ UExtbyte buf[4096];
+ Bytecount nread;
+ int fd = -1;
+ struct stat st;
+
+ filename = Fexpand_file_name (filename, Qnil);
+
+ if (qxe_stat (XSTRING_DATA (filename), &st) < 0)
+ {
+ badopen:
+ report_file_error ("Opening input file", filename);
+ }
+
+ if (fd < 0)
+ {
+ if ((fd = qxe_interruptible_open (XSTRING_DATA (filename),
+ O_RDONLY | OPEN_BINARY, 0)) < 0)
+ goto badopen;
+ }
+
+ lstream = make_filedesc_input_stream (fd, 0, -1, 0);
+ Lstream_set_buffering (XLSTREAM (lstream), LSTREAM_UNBUFFERED, 0);
+ nread = Lstream_read (XLSTREAM (lstream), buf, sizeof (buf));
+ Lstream_delete (XLSTREAM (lstream));
+ retry_close (fd);
+
+ return look_for_coding_system_magic_cookie (buf, nread, 0);
+}
#ifdef DEBUG_XEMACS
@@ -4524,6 +4579,7 @@
DEFSUBR (Fdecode_coding_region);
DEFSUBR (Fencode_coding_region);
DEFSUBR (Fquery_coding_region);
+ DEFSUBR (Ffind_coding_system_magic_cookie_in_file);
DEFSYMBOL_MULTIWORD_PREDICATE (Qcoding_systemp);
DEFSYMBOL (Qno_conversion);
DEFSYMBOL (Qconvert_eol);
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/XEmacs: kehoea: Unify #'find-coding-system-magic-cookie-in-file, look_for_coding_system_magic_cookie()
12 years, 3 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/changeset/dae33b5feffe/
changeset: dae33b5feffe
user: kehoea
date: 2012-09-07 23:06:01
summary: Unify #'find-coding-system-magic-cookie-in-file, look_for_coding_system_magic_cookie()
src/ChangeLog addition:
2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
* file-coding.c:
* file-coding.c (snarf_coding_system):
Take a new parameter, FIND_CODING_SYSTEM_P, which indicates that
find_coding_system() should be called.
* file-coding.c (look_for_coding_system_magic_cookie):
* file-coding.c (determine_real_coding_system):
* file-coding.c (undecided_convert):
Use this parameter.
* file-coding.c (Ffind_coding_system_magic_cookie_in_file):
New, moved from files.el, so we can use
look_for_coding_system_magic_cookie's implementation.
* file-coding.c (syms_of_file_coding):
Make Ffind_coding_system_magic_cookie_in_file available.
lisp/ChangeLog addition:
2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
* files.el:
* files.el (find-coding-system-magic-cookie-in-file):
Removed. Move this to C, so we can use
look_for_coding_system_magic_cookie().
affected #: 4 files
diff -r 4af5a3435c94358798bcd2e56c51eaebbc5f36d2 -r dae33b5feffeee270840946d709b40dfae7e4689 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * files.el:
+ * files.el (find-coding-system-magic-cookie-in-file):
+ Removed. Move this to C, so we can use
+ look_for_coding_system_magic_cookie().
+
2012-08-02 Stephen J. Turnbull <stephen(a)xemacs.org>
* XEmacs 21.5.32 "habanero" is released.
diff -r 4af5a3435c94358798bcd2e56c51eaebbc5f36d2 -r dae33b5feffeee270840946d709b40dfae7e4689 lisp/files.el
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2126,52 +2126,6 @@
;; Ordinary variable, really set it.
(t (make-local-variable var)
(set var val))))
-
-(defun find-coding-system-magic-cookie-in-file (file)
- "Look for the coding-system magic cookie in FILE.
-The coding-system magic cookie is either the local variable specification
--*- ... coding: ... -*- on the first line, or the exact string
-\";;;###coding system: \" somewhere within the first 3000 characters
-of the file. If found, the coding system name (as a string) is returned;
-otherwise nil is returned. Note that it is extremely unlikely that
-either such string would occur coincidentally as the result of encoding
-some characters in a non-ASCII charset, and that the spaces make it
-even less likely since the space character is not a valid octet in any
-ISO 2022 encoding of most non-ASCII charsets."
- (save-excursion
- (with-temp-buffer
- (let ((coding-system-for-read 'raw-text))
- (insert-file-contents file nil 0 3000))
- (goto-char (point-min))
- (or (and (looking-at
- "^[^\n]*-\\*-[^\n]*coding: \\([^ \t\n;]+\\)[^\n]*-\\*-")
- (buffer-substring (match-beginning 1) (match-end 1)))
- ;; (save-excursion
- ;; (let (start end)
- ;; (and (re-search-forward "^;+[ \t]*Local Variables:" nil t)
- ;; (setq start (match-end 0))
- ;; (re-search-forward "\n;+[ \t]*End:")
- ;; (setq end (match-beginning 0))
- ;; (save-restriction
- ;; (narrow-to-region start end)
- ;; (goto-char start)
- ;; (re-search-forward "^;;; coding: \\([^\n]+\\)$" nil t)
- ;; )
- ;; (let ((codesys
- ;; (intern (buffer-substring
- ;; (match-beginning 1)(match-end 1)))))
- ;; (if (find-coding-system codesys) codesys))
- ;; )))
- (let ((case-fold-search nil))
- (if (search-forward
- ";;;###coding system: " (+ (point-min) 3000) t)
- (let ((start (point))
- (end (progn
- (skip-chars-forward "^ \t\n\r")
- (point))))
- (if (> end start) (buffer-substring start end))
- )))
- ))))
(defcustom change-major-mode-with-file-name t
diff -r 4af5a3435c94358798bcd2e56c51eaebbc5f36d2 -r dae33b5feffeee270840946d709b40dfae7e4689 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,19 @@
+2012-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * file-coding.c:
+ * file-coding.c (snarf_coding_system):
+ Take a new parameter, FIND_CODING_SYSTEM_P, which indicates that
+ find_coding_system() should be called.
+ * file-coding.c (look_for_coding_system_magic_cookie):
+ * file-coding.c (determine_real_coding_system):
+ * file-coding.c (undecided_convert):
+ Use this parameter.
+ * file-coding.c (Ffind_coding_system_magic_cookie_in_file):
+ New, moved from files.el, so we can use
+ look_for_coding_system_magic_cookie's implementation.
+ * file-coding.c (syms_of_file_coding):
+ Make Ffind_coding_system_magic_cookie_in_file available.
+
2012-09-05 Aidan Kehoe <kehoea(a)parhasard.net>
* keymap.c:
diff -r 4af5a3435c94358798bcd2e56c51eaebbc5f36d2 -r dae33b5feffeee270840946d709b40dfae7e4689 src/file-coding.c
--- a/src/file-coding.c
+++ b/src/file-coding.c
@@ -79,6 +79,7 @@
#include "extents.h"
#include "rangetab.h"
#include "chartab.h"
+#include "sysfile.h"
#ifdef HAVE_ZLIB
#include "zlib.h"
@@ -3674,7 +3675,8 @@
blanks). If found, return it, otherwise nil. */
static Lisp_Object
-snarf_coding_system (const UExtbyte *p, Bytecount len)
+snarf_coding_system (const UExtbyte *p, Bytecount len,
+ Boolint find_coding_system_p)
{
Bytecount n;
UExtbyte *name;
@@ -3698,7 +3700,16 @@
name[n] = '\0';
/* This call to intern_istring() is OK because we already verified that
there are only ASCII characters in the string */
- return find_coding_system_for_text_file (intern_istring ((Ibyte *) name), 0);
+ if (find_coding_system_p)
+ {
+ return
+ find_coding_system_for_text_file (intern_istring ((Ibyte *) name),
+ 0);
+ }
+ else
+ {
+ return build_ascstring ((const Ascbyte *) name);
+ }
}
return Qnil;
@@ -3725,11 +3736,9 @@
return Qnil;
}
-/* #### This duplicates code in `find-coding-system-magic-cookie-in-file'
- in files.el. Look into combining them. */
-
static Lisp_Object
-look_for_coding_system_magic_cookie (const UExtbyte *data, Bytecount len)
+look_for_coding_system_magic_cookie (const UExtbyte *data, Bytecount len,
+ Boolint find_coding_system_p)
{
const UExtbyte *p;
const UExtbyte *scan_end;
@@ -3767,7 +3776,8 @@
*(p-1) == ';')))
{
p += LENGTH ("coding:");
- return snarf_coding_system (p, suffix - p);
+ return snarf_coding_system (p, suffix - p,
+ find_coding_system_p);
break;
}
break;
@@ -3792,7 +3802,7 @@
suffix = p;
while (suffix < scan_end && !isspace (*suffix))
suffix++;
- return snarf_coding_system (p, suffix - p);
+ return snarf_coding_system (p, suffix - p, find_coding_system_p);
}
}
@@ -3807,7 +3817,8 @@
make_opaque_ptr (st));
UExtbyte buf[4096];
Bytecount nread = Lstream_read (stream, buf, sizeof (buf));
- Lisp_Object coding_system = look_for_coding_system_magic_cookie (buf, nread);
+ Lisp_Object coding_system
+ = look_for_coding_system_magic_cookie (buf, nread, 1);
if (NILP (coding_system))
{
@@ -3971,7 +3982,7 @@
/* #### This is cheesy. What we really ought to do is buffer
up a certain minimum amount of data to get a better result.
*/
- data->actual = look_for_coding_system_magic_cookie (src, n);
+ data->actual = look_for_coding_system_magic_cookie (src, n, 1);
if (NILP (data->actual))
{
/* #### This is cheesy. What we really ought to do is buffer
@@ -4216,6 +4227,50 @@
return val;
}
+DEFUN ("find-coding-system-magic-cookie-in-file",
+ Ffind_coding_system_magic_cookie_in_file, 1, 1, 0, /*
+Look for the coding-system magic cookie in FILENAME.
+The coding-system magic cookie is either the local variable specification
+-*- ... coding: ... -*- on the first line, or the exact string
+\";;;###coding system: \" somewhere within the first 3000 characters
+of the file. If found, the coding system name (as a string) is returned;
+otherwise nil is returned. Note that it is extremely unlikely that
+either such string would occur coincidentally as the result of encoding
+some characters in a non-ASCII charset, and that the spaces make it
+even less likely since the space character is not a valid octet in any
+ISO 2022 encoding of most non-ASCII charsets.
+*/
+ (filename))
+{
+ Lisp_Object lstream;
+ UExtbyte buf[4096];
+ Bytecount nread;
+ int fd = -1;
+ struct stat st;
+
+ filename = Fexpand_file_name (filename, Qnil);
+
+ if (qxe_stat (XSTRING_DATA (filename), &st) < 0)
+ {
+ badopen:
+ report_file_error ("Opening input file", filename);
+ }
+
+ if (fd < 0)
+ {
+ if ((fd = qxe_interruptible_open (XSTRING_DATA (filename),
+ O_RDONLY | OPEN_BINARY, 0)) < 0)
+ goto badopen;
+ }
+
+ lstream = make_filedesc_input_stream (fd, 0, -1, 0);
+ Lstream_set_buffering (XLSTREAM (lstream), LSTREAM_UNBUFFERED, 0);
+ nread = Lstream_read (XLSTREAM (lstream), buf, sizeof (buf));
+ Lstream_delete (XLSTREAM (lstream));
+ retry_close (fd);
+
+ return look_for_coding_system_magic_cookie (buf, nread, 0);
+}
#ifdef DEBUG_XEMACS
@@ -4524,6 +4579,7 @@
DEFSUBR (Fdecode_coding_region);
DEFSUBR (Fencode_coding_region);
DEFSUBR (Fquery_coding_region);
+ DEFSUBR (Ffind_coding_system_magic_cookie_in_file);
DEFSYMBOL_MULTIWORD_PREDICATE (Qcoding_systemp);
DEFSYMBOL (Qno_conversion);
DEFSYMBOL (Qconvert_eol);
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches