commit/XEmacs: stephen_at_xemacs: Sort buffers-tab list before
truncating it.
7 years, 1 month
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/d58b1c68ec10/
Changeset: d58b1c68ec10
User: stephen_at_xemacs
Date: 2017-11-14 05:14:25+00:00
Summary: Sort buffers-tab list before truncating it.
Affected #: 2 files
diff -r 9947c027739a4cb6c5b3d39b4a25e20dff653557 -r d58b1c68ec10a5f5c29361ec82f9376a4073662d lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-14 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * gutter-items.el (buffers-tab-items):
+ Sort list before truncating it. Clarify logic, remove comment.
+
2017-11-13 Aidan Kehoe <kehoea(a)parhasard.net>
* unicode.el (decode-char):
diff -r 9947c027739a4cb6c5b3d39b4a25e20dff653557 -r d58b1c68ec10a5f5c29361ec82f9376a4073662d lisp/gutter-items.el
--- a/lisp/gutter-items.el
+++ b/lisp/gutter-items.el
@@ -268,8 +268,7 @@
;; context buffer before they get run.
(let* ((buffers (delete-if
buffers-tab-omit-function (buffer-list frame)))
- (first-buf (car buffers))
- tail)
+ (first-buf (car buffers)))
;; maybe force the selected window
(when (and force-selection
(not in-deletion)
@@ -290,16 +289,16 @@
buffers-tab-filter-functions)
(list buffer)))
buffers)))
- ;; maybe shorten list of buffers
- (let ((n (1-
- ;; Error on non-number, non-nil buffers-tab-max-size
- (or buffers-tab-max-size most-positive-fixnum))))
- (and (> n 0)
- (setf tail (nthcdr n buffers)) ;; Length greater than (1+ n)?
- (setf (cdr tail) nil)))
;; sort buffers in group (default is most-recently-selected)
(when buffers-tab-sort-function
(setq buffers (funcall buffers-tab-sort-function buffers)))
+ ;; maybe shorten list of buffers
+ (when (fixnump buffers-tab-max-size)
+ (let ((n (1- buffers-tab-max-size))
+ tail)
+ (and (> n 0)
+ (setf tail (nthcdr n buffers)) ;; Length greater than (1+ n)?
+ (setf (cdr tail) nil)))
(labels
((build-buffers-tab-internal (buffers)
"Convert BUFFERS to a list of structures used by the tab widget."
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.
commit/XEmacs: 2 new changesets
7 years, 1 month
Bitbucket
2 new commits in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/1cc781a3cdc2/
Changeset: 1cc781a3cdc2
User: stephen_at_xemacs
Date: 2017-11-14 04:02:04+00:00
Summary: Clarify docstrings for buffer tabs.
Affected #: 2 files
diff -r 9764d52c3fd9829a3a53f090f971033c0cd34f37 -r 1cc781a3cdc24b0efdb48fd7558f3caeef95c78c lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -26,6 +26,21 @@
the same symbol name as the let binding, delay shadowing until all
bindings are processed.
+2017-10-26 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * gutter-items.el (buffers-tab-omit-function):
+ (buffers-tab-omit-list):
+ (buffers-tab-selection-function):
+ (buffers-tab-filter-functions):
+ (buffers-tab-sort-function):
+ (buffers-tab-grouping-regexp):
+ (buffers-tab-format-buffer-line-function):
+ (format-buffers-tab-line):
+ (buffers-tab-items):
+ (add-tab-to-gutter):
+ (update-tab-in-gutter):
+ Clarify docstrings.
+
2017-10-12 Aidan Kehoe <kehoea(a)parhasard.net>
* frame.el (frame-utmost-window-2): Made into a label.
diff -r 9764d52c3fd9829a3a53f090f971033c0cd34f37 -r 1cc781a3cdc24b0efdb48fd7558f3caeef95c78c lisp/gutter-items.el
--- a/lisp/gutter-items.el
+++ b/lisp/gutter-items.el
@@ -69,18 +69,18 @@
:group 'buffers-tab)
(defcustom buffers-tab-omit-function 'buffers-tab-omit-some-buffers
- "*If non-nil, a function specifying the buffers to omit from the buffers tab.
+ "*If non-nil, a predicate matching buffers to omit from the buffers tab.
This is passed a buffer and should return non-nil if the buffer should be
omitted. The default value `buffers-tab-omit-some-buffers' omits
-buffers based on the value of `buffers-tab-omit-list'."
+buffers with names matched by any regexp in `buffers-tab-omit-list'."
:type '(choice (const :tag "None" nil)
function)
:group 'buffers-tab)
(defcustom buffers-tab-omit-list '("\\` ")
- "*A list of types of buffers to omit from the buffers tab.
-This is only used if `buffers-tab-omit-function' is set to
-`buffers-tab-omit-some-buffers', its default value."
+ "*A list of regexps matching names of buffers to omit from the buffers tab.
+This is used by `buffers-tab-omit-some-buffers' \(the default value of
+`buffers-tab-omit-function')."
:type '(checklist
:greedy t
:format "%{Omit List%}: \n%v"
@@ -102,8 +102,9 @@
:group 'buffers-tab)
(defvar buffers-tab-selection-function 'select-buffers-tab-buffers-by-mode
- "*If non-nil, a function specifying the buffers to select in the
-buffers tab. This is passed two buffers and should return non-nil if
+ "*If non-nil, a predicate selecting buffers eligible for the buffers tab.
+
+This is passed a buffer to test and a comparison buffer, returning non-nil if
the first buffer should be selected. The default value
`select-buffers-tab-buffers-by-mode' groups buffers by major mode and
by `buffers-tab-grouping-regexp'.")
@@ -112,12 +113,12 @@
"Set `buffers-tab-filter-functions' instead.")
(defcustom buffers-tab-filter-functions (list 'select-buffers-tab-buffers-by-mode)
- "*A list of functions specifying buffers to display in the buffers tab.
+ "*A list of predicates selecting buffers eligible for the buffers tab.
If nil, all buffers are kept, up to `buffers-tab-max-size', in usual order.
Otherwise, each function in the list must take arguments (BUF1 BUF2).
-BUF1 is the candidate, and BUF2 is the current buffer (first in the buffers
-list). The function should return non-nil if BUF1 should be added to the
+BUF1 is the candidate, and BUF2 is a comparison buffer \(usually the current
+buffer). The function returns non-nil to request that BUF1 be added to the
buffers tab. BUF1 will be omitted if any of the functions returns nil.
Defaults to `select-buffers-tab-buffers-by-mode', which adds BUF1 if BUF1 and
@@ -127,10 +128,11 @@
:group 'buffers-tab)
(defcustom buffers-tab-sort-function nil
- "*If non-nil, a function specifying the buffers to select from the
-buffers tab. This is passed the buffer list and returns the list in the
-order desired for the tab widget. The default value `nil' leaves the
-list in `buffer-list' order (usual most-recently-selected-first)."
+ "*If non-nil, a function specifying precedence of buffers in the buffers tab.
+
+This is passed the buffer list and returns the list in the order desired for
+the tab widget. The default value `nil' leaves the list in `buffer-list'
+order (usual most-recently-selected-first)."
:type '(choice (const :tag "None" nil)
function)
@@ -148,21 +150,20 @@
'("^\\(gnus-\\|message-mode\\|mime/viewer-mode\\)"
"^\\(emacs-lisp-\\|lisp-\\)")
"*If non-nil, a list of regular expressions for buffer grouping.
-Each regular expression is applied to the current major-mode symbol
-name and mode-name, if it matches then any other buffers that match
-the same regular expression be added to the current group."
+
+If two buffers' modes or mode names both are matched by any regular expression
+in the list, they are considered equivalent when selecting buffers by major
+mode."
:type '(choice (const :tag "None" nil)
sexp)
:group 'buffers-tab)
(defcustom buffers-tab-format-buffer-line-function 'format-buffers-tab-line
- "*The function to call to return a string to represent a buffer in the
-buffers tab. The function is passed a buffer and should return a
-string. The default value `format-buffers-tab-line' just returns the
-name of the buffer, optionally truncated to
-`buffers-tab-max-buffer-line-length'. Also check out
-`slow-format-buffers-menu-line' which returns a whole bunch of info
-about a buffer."
+ "*A function returning a string representing the buffer passed.
+
+The default value `format-buffers-tab-line' returns the name of the buffer,
+truncated to `buffers-tab-max-buffer-line-length'. An alternative is
+`slow-format-buffers-menu-line' which returns more info about the buffer."
:type 'function
:group 'buffers-tab)
@@ -228,8 +229,9 @@
(t nil))))
(defun format-buffers-tab-line (buffer)
- "For use as a value of `buffers-tab-format-buffer-line-function'.
-This just returns the buffer's name, optionally truncated."
+ "Return BUFFER's name, truncated to `buffers-tab-default-buffer-line-length'.
+For use as a value of `buffers-tab-format-buffer-line-function'."
+
(let* ((len (specifier-instance buffers-tab-default-buffer-line-length))
(buffer-name (buffer-name buffer))
(length (length buffer-name)))
@@ -247,21 +249,27 @@
;;; cumulative --andyp.
(defun buffers-tab-items (&optional in-deletion frame force-selection)
"Return a list of tab instantiators based on the current buffers list.
-This function is used as the tab filter for the top-level buffers
-\"Buffers\" tab. It dynamically creates a list of tab instantiators
-to use as the contents of the tab. The contents and order of the list
-is controlled by `buffers-tab-filter-functions' which by default
-groups buffers according to major mode and removes invisible buffers.
-You can control how many buffers will be shown by setting
-`buffers-tab-max-size'. You can control the text of the tab items by
-redefining the function `format-buffers-menu-line'."
+
+This is the tab filter for the top-level buffers \"Buffers\" tab.
+It dynamically creates a list of tab instantiators to use as the contents of
+the tab. The contents and order of the list is controlled by
+`buffers-tab-filter-functions' which by default groups buffers according to
+major mode and removes invisible buffers. At most `buffers-tab-max-size'
+tabs will be added to the control. The label for each tab is produced by
+`format-buffers-menu-line'.
+
+Optional IN-DELETION is an internal flag indicating a buffer is being deleted.
+Optional FRAME is the frame whose buffer list is used, defaulting to the
+selected frame.
+Optional FORCE-SELECTION makes the currently selected window first in list."
(save-match-data
;; NB it is too late if we run the omit function as part of the
;; filter functions because we need to know which buffer is the
;; context buffer before they get run.
(let* ((buffers (delete-if
buffers-tab-omit-function (buffer-list frame)))
- (first-buf (car buffers)) tail)
+ (first-buf (car buffers))
+ tail)
;; maybe force the selected window
(when (and force-selection
(not in-deletion)
@@ -309,7 +317,7 @@
(build-buffers-tab-internal buffers)))))
(defun add-tab-to-gutter ()
- "Put a tab control in the gutter area to hold the most recent buffers."
+ "Put a tab control in the gutter area to select buffers."
(setq gutter-buffers-tab-orientation (default-gutter-position))
(let* ((gutter-string (copy-sequence "\n"))
(gutter-buffers-tab-extent (make-extent 0 1 gutter-string)))
@@ -344,8 +352,8 @@
x)))))))
(defun update-tab-in-gutter (frame &optional force-selection)
- "Update the tab control in the gutter area."
- ;; dedicated frames don't get tabs
+ "Update the tab control in the gutter area.
+Optional FORCE-SELECTION makes the currently selected window first in list." ;; dedicated frames don't get tabs
(unless (or (window-dedicated-p (frame-selected-window frame))
(frame-property frame 'popup))
(when (specifier-instance default-gutter-visible-p frame)
https://bitbucket.org/xemacs/xemacs/commits/9947c027739a/
Changeset: 9947c027739a
User: stephen_at_xemacs
Date: 2017-11-14 04:27:39+00:00
Summary: Correct comment for shift_jis.
Affected #: 2 files
diff -r 1cc781a3cdc24b0efdb48fd7558f3caeef95c78c -r 9947c027739a4cb6c5b3d39b4a25e20dff653557 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -28,6 +28,10 @@
2017-10-26 Stephen J. Turnbull <stephen(a)xemacs.org>
+ * mule/japanese.el (shift_jis): Correct comment.
+
+2017-10-26 Stephen J. Turnbull <stephen(a)xemacs.org>
+
* gutter-items.el (buffers-tab-omit-function):
(buffers-tab-omit-list):
(buffers-tab-selection-function):
diff -r 1cc781a3cdc24b0efdb48fd7558f3caeef95c78c -r 9947c027739a4cb6c5b3d39b4a25e20dff653557 lisp/mule/japanese.el
--- a/lisp/mule/japanese.el
+++ b/lisp/mule/japanese.el
@@ -292,7 +292,7 @@
documentation "The standard Japanese encoding in MS Windows."
))
-;; A former name?
+;; The registered MIME name uses an underscore.
(define-coding-system-alias 'shift_jis 'shift-jis)
;; FSF:
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.
commit/XEmacs: kehoea: Reduce test errors under no-Mule,
mostly from case-tests.el
7 years, 1 month
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/9764d52c3fd9/
Changeset: 9764d52c3fd9
User: kehoea
Date: 2017-11-13 23:19:01+00:00
Summary: Reduce test errors under no-Mule, mostly from case-tests.el
tests/ChangeLog addition:
2017-11-13 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/case-tests.el:
Change the encoding of this to iso-8859-1, so non-mule doesn't
choke on old-format case tables.
* automated/case-tests.el (downcase1):
Create strings using non-Latin-1 using (format "...%c..."
(decode-char 'ucs CODE) at runtime, rather than simply confusing a
non-mule build at read time.
* automated/case-tests.el (uni-mappings):
Use #'decode-char at runtime, don't assume non-Mule can read a
long list of mostly non-ASCII characters.
* automated/extent-tests.el (string):
Check whether CURRENT-LANGUAGE-ENVIRONMENT is bound (only if Mule)
before dereferencing it.
* automated/format-tests.el (Assert):
Be better about not expecting the Lisp reader to understand
non-Latin-1, use decode-char at runtime.
Mark a few tests with Implementation-Incomplete-Expect-Failure.
src/ChangeLog addition:
2017-11-13 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecode.c (bytecode_arithcompare):
Rename a couple of local variables to quieten the compiler about
shadowing.
* doprnt.c (rewrite_floating_spec):
Mark OBJ as used if HAVE_BIGFLOAT is not defined, to quieten the
compiler.
lisp/ChangeLog addition:
2017-11-13 Aidan Kehoe <kehoea(a)parhasard.net>
* unicode.el (decode-char):
Return nil instead of erroring when CODE cannot be encoded, as did
this function pre-unicode-internal and as does (did) GNU's
version.
Affected #: 9 files
diff -r d79c7749a1011bfb27c1209ff365758f7e95ae51 -r 9764d52c3fd9829a3a53f090f971033c0cd34f37 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2017-11-13 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * unicode.el (decode-char):
+ Return nil instead of erroring when CODE cannot be encoded, as did
+ this function pre-unicode-internal and as does (did) GNU's
+ version.
+
2017-11-09 Aidan Kehoe <kehoea(a)parhasard.net>
Ben's approach in lib-src/make-case-conv.el didn't work, there are
diff -r d79c7749a1011bfb27c1209ff365758f7e95ae51 -r 9764d52c3fd9829a3a53f090f971033c0cd34f37 lisp/unicode.el
--- a/lisp/unicode.el
+++ b/lisp/unicode.el
@@ -87,7 +87,7 @@
(check-argument-range code #x0 #x10FFFF)
(assert (eq quote-ucs 'ucs) t
"Sorry, decode-char doesn't yet support anything but the UCS. ")
- (unicode-to-char code))
+ (unicode-to-char code nil 'fail))
(defun encode-char (char quote-ucs &optional restriction)
"FSF compatibility--return the Unicode code point of CHAR.
diff -r d79c7749a1011bfb27c1209ff365758f7e95ae51 -r 9764d52c3fd9829a3a53f090f971033c0cd34f37 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2017-11-13 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecode.c (bytecode_arithcompare):
+ Rename a couple of local variables to quieten the compiler about
+ shadowing.
+ * doprnt.c (rewrite_floating_spec):
+ Mark OBJ as used if HAVE_BIGFLOAT is not defined, to quieten the
+ compiler.
+
2017-11-11 Aidan Kehoe <kehoea(a)parhasard.net>
* data.c:
diff -r d79c7749a1011bfb27c1209ff365758f7e95ae51 -r 9764d52c3fd9829a3a53f090f971033c0cd34f37 src/bytecode.c
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -333,9 +333,9 @@
if (MARKERP (obj2)
&& (XMARKER (obj1)->buffer == XMARKER (obj2)->buffer))
{
- Bytebpos ival1 = byte_marker_position (obj1);
- Bytebpos ival2 = byte_marker_position (obj2);
- return ival1 < ival2 ? -1 : ival1 > ival2 ? 1 : 0;
+ Bytebpos bpval1 = byte_marker_position (obj1);
+ Bytebpos bpval2 = byte_marker_position (obj2);
+ return bpval1 < bpval2 ? -1 : bpval1 > bpval2 ? 1 : 0;
}
ival1 = marker_position (obj1);
diff -r d79c7749a1011bfb27c1209ff365758f7e95ae51 -r 9764d52c3fd9829a3a53f090f971033c0cd34f37 src/doprnt.c
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -1768,6 +1768,8 @@
/* Leave obj alone. */
return ch;
}
+#else
+ USED (obj);
#endif
/* The float spec code calls extract_float(), this is a far less complex
diff -r d79c7749a1011bfb27c1209ff365758f7e95ae51 -r 9764d52c3fd9829a3a53f090f971033c0cd34f37 tests/ChangeLog
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,23 @@
+2017-11-13 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/case-tests.el:
+ Change the encoding of this to iso-8859-1, so non-mule doesn't
+ choke on old-format case tables.
+ * automated/case-tests.el (downcase1):
+ Create strings using non-Latin-1 using (format "...%c..."
+ (decode-char 'ucs CODE) at runtime, rather than simply confusing a
+ non-mule build at read time.
+ * automated/case-tests.el (uni-mappings):
+ Use #'decode-char at runtime, don't assume non-Mule can read a
+ long list of mostly non-ASCII characters.
+ * automated/extent-tests.el (string):
+ Check whether CURRENT-LANGUAGE-ENVIRONMENT is bound (only if Mule)
+ before dereferencing it.
+ * automated/format-tests.el (Assert):
+ Be better about not expecting the Lisp reader to understand
+ non-Latin-1, use decode-char at runtime.
+ Mark a few tests with Implementation-Incomplete-Expect-Failure.
+
2017-11-11 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
This diff is so big that we needed to truncate the remainder.
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.
commit/cc-mode: acm: CC Mode: Fix defun-open being recognized as
brace-list-open at EOB.
7 years, 1 month
Bitbucket
1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/f30859593cbf/
Changeset: f30859593cbf
User: acm
Date: 2017-11-12 11:32:17+00:00
Summary: CC Mode: Fix defun-open being recognized as brace-list-open at EOB.
* cc-engine.el (c-looking-at-statement-block): Add handling for an open brace
at EOB and nested braces inside an unclosed brace block.
Affected #: 1 file
diff -r 655ca3305b88fefc49a564bf97340b65da01da8f -r f30859593cbf2f12da6fbd1827786a87b123ab2d cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -10749,10 +10749,8 @@
(t ; We're at (1+ here).
(cond
((progn (c-forward-syntactic-ws)
- (eq (point) (1- there)))
- t)
- ((c-syntactic-re-search-forward c-keywords-regexp there t)
- t)
+ (eq (point) (1- there))))
+ ((c-syntactic-re-search-forward c-keywords-regexp there t))
((c-syntactic-re-search-forward "{" there t t)
(backward-char)
(c-looking-at-statement-block))
@@ -10761,8 +10759,12 @@
(cond
((c-syntactic-re-search-forward "[;,]" nil t t)
(eq (char-before) ?\;))
- ((c-syntactic-re-search-forward c-keywords-regexp nil t t)
- t)
+ ((progn (c-forward-syntactic-ws)
+ (eobp)))
+ ((c-syntactic-re-search-forward c-keywords-regexp nil t t))
+ ((c-syntactic-re-search-forward "{" nil t t)
+ (backward-char)
+ (c-looking-at-statement-block))
(t nil)))
(goto-char here))))
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.
commit/XEmacs: kehoea: Make min(),
max() available as macros in lwlib too.
7 years, 1 month
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/d79c7749a101/
Changeset: d79c7749a101
User: kehoea
Date: 2017-11-12 00:09:24+00:00
Summary: Make min(), max() available as macros in lwlib too.
lwlib/ChangeLog addition:
2017-11-12 Aidan Kehoe <kehoea(a)parhasard.net>
* lwlib-internal.h:
Make min(), max() available as macros to lwlib as well as to the
core code. Thank you Mats Lidell and the buildbot.
Affected #: 2 files
diff -r c8b7adfa23c6f68a106755cc970296763c2ed59d -r d79c7749a1011bfb27c1209ff365758f7e95ae51 lwlib/ChangeLog
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-12 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * lwlib-internal.h:
+ Make min(), max() available as macros to lwlib as well as to the
+ core code. Thank you Mats Lidell and the buildbot.
+
2016-12-30 Aidan Kehoe <kehoea(a)parhasard.net>
* lwlib-Xlw.c (xlw_update_one_widget):
diff -r c8b7adfa23c6f68a106755cc970296763c2ed59d -r d79c7749a1011bfb27c1209ff365758f7e95ae51 lwlib/lwlib-internal.h
--- a/lwlib/lwlib-internal.h
+++ b/lwlib/lwlib-internal.h
@@ -37,6 +37,17 @@
# endif
#endif
+/* Define min() and max(). (Some compilers put them in strange places that
+ won't be referenced by include files used by XEmacs, such as `macros.h'
+ under Solaris.) */
+
+#ifndef min
+# define min(a,b) (((a) <= (b)) ? (a) : (b))
+#endif
+#ifndef max
+# define max(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
/* This represents a single widget within a widget tree. All the
widgets in a widget tree are chained through the `next' field.
`info' is a back pointer to the widget tree. */
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.
commit/XEmacs: kehoea: Make % behave more consistently with varying
signs, bignums
7 years, 1 month
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/c8b7adfa23c6/
Changeset: c8b7adfa23c6
User: kehoea
Date: 2017-11-11 09:42:50+00:00
Summary: Make % behave more consistently with varying signs, bignums
src/ChangeLog addition:
2017-11-11 Aidan Kehoe <kehoea(a)parhasard.net>
* data.c:
* data.c (rem_two_fixnum): New.
Return the result of the % operator on two EMACS_INTs. Standardise
on the sign so we don't have to put up with the quirks of the
local C implementation.
* data.c (Frem):
Document the meaning of %, cross reference to the C standard;
document that the result will have the sign of NUMBER1.
* lisp.h (EMACS_INT_ABS): New.
Make a version of abs() available appropriate for an EMACS_INT.
* doprnt.c (doprnt_1):
Use this version of abs().
tests/ChangeLog addition:
2017-11-11 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
Check for the %-equivalence documented in the C standard for
bignums too.
Affected #: 6 files
diff -r 7ce0eaac52e01c1f46b35f8a36d08abcd3bbc0a6 -r c8b7adfa23c6f68a106755cc970296763c2ed59d src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
+2017-11-11 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * data.c:
+ * data.c (rem_two_fixnum): New.
+ Return the result of the % operator on two EMACS_INTs. Standardise
+ on the sign so we don't have to put up with the quirks of the
+ local C implementation.
+ * data.c (Frem):
+ Document the meaning of %, cross reference to the C standard;
+ document that the result will have the sign of NUMBER1.
+ * lisp.h (EMACS_INT_ABS): New.
+ Make a version of abs() available appropriate for an EMACS_INT.
+ * doprnt.c (doprnt_1):
+ Use this version of abs().
+
2017-11-09 Aidan Kehoe <kehoea(a)parhasard.net>
* mule-ccl.c (ccl_driver):
diff -r 7ce0eaac52e01c1f46b35f8a36d08abcd3bbc0a6 -r c8b7adfa23c6f68a106755cc970296763c2ed59d src/data.c
--- a/src/data.c
+++ b/src/data.c
@@ -2900,9 +2900,43 @@
return make_fixnum (~ fixnum_char_or_marker_to_int (number));
}
+static Lisp_Object
+rem_two_fixnum (EMACS_INT number1, EMACS_INT number2)
+{
+ EMACS_UINT val1, val2;
+ EMACS_INT sign;
+
+ if (0 == number2)
+ {
+ Fsignal (Qarith_error, Qnil);
+ }
+
+ if (number1 < 0)
+ {
+ sign = -1;
+ val1 = -number1;
+ }
+ else
+ {
+ sign = 1;
+ val1 = number1;
+ }
+
+ val2 = EMACS_INT_ABS (number2);
+
+ return make_fixnum ((EMACS_INT)((val1 % val2) * sign));
+}
+
DEFUN ("%", Frem, 2, 2, 0, /*
-Return remainder of first arg divided by second.
-Both must be integers, characters or markers.
+Return remainder of NUMBER1 divided by NUMBER2.
+
+Both must be integers, characters or markers. This is the remainder in the C
+sense, so the following equivalence (from the C standard) holds:
+
+\(eql NUMBER1 (+ (* (/ NUMBER1 NUMBER2) NUMBER2) (% NUMBER1 NUMBER2)))
+
+In this implementation, the result will have the sign of NUMBER1, something
+not standardized in C.
*/
(number1, number2))
{
@@ -2914,26 +2948,34 @@
if (promote_args (&number1, &number2) == FIXNUM_T)
{
- if (XREALFIXNUM (number2) == 0)
- Fsignal (Qarith_error, Qnil);
- return make_fixnum (XREALFIXNUM (number1) % XREALFIXNUM (number2));
+ return rem_two_fixnum (XREALFIXNUM (number1), XREALFIXNUM (number2));
}
else
{
if (bignum_sign (XBIGNUM_DATA (number2)) == 0)
- Fsignal (Qarith_error, Qnil);
- bignum_mod (scratch_bignum, XBIGNUM_DATA (number1),
- XBIGNUM_DATA (number2));
+ {
+ Fsignal (Qarith_error, Qnil);
+ }
+ if (bignum_sign (XBIGNUM_DATA (number1)) > -1)
+ {
+ bignum_mod (scratch_bignum, XBIGNUM_DATA (number1),
+ XBIGNUM_DATA (number2));
+ }
+ else
+ {
+ bignum_neg (scratch_bignum, XBIGNUM_DATA (number1));
+ bignum_mod (scratch_bignum2, scratch_bignum,
+ XBIGNUM_DATA (number2));
+ bignum_neg (scratch_bignum, scratch_bignum2);
+ }
+
return Fcanonicalize_number (make_bignum_bg (scratch_bignum));
}
#else /* !HAVE_BIGNUM */
EMACS_INT ival1 = fixnum_char_or_marker_to_int (number1);
EMACS_INT ival2 = fixnum_char_or_marker_to_int (number2);
- if (ival2 == 0)
- Fsignal (Qarith_error, Qnil);
-
- return make_fixnum (ival1 % ival2);
+ return rem_two_fixnum (ival1, ival2);
#endif /* HAVE_BIGNUM */
}
diff -r 7ce0eaac52e01c1f46b35f8a36d08abcd3bbc0a6 -r c8b7adfa23c6f68a106755cc970296763c2ed59d src/doprnt.c
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -926,7 +926,7 @@
}
}
filllen = (max (zeros_to_add, 0) + 1 /* sign flag */
- + 2 /* number flag */ + labs (padding_to_add))
+ + 2 /* number flag */ + EMACS_INT_ABS (padding_to_add))
* MAX_ICHAR_LEN;
filling = fill_cursor = alloca_ibytes (filllen);
diff -r 7ce0eaac52e01c1f46b35f8a36d08abcd3bbc0a6 -r c8b7adfa23c6f68a106755cc970296763c2ed59d src/lisp.h
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -503,6 +503,15 @@
#define BITS_PER_EMACS_INT (SIZEOF_EMACS_INT * BITS_PER_CHAR)
+/* Make a version of abs() available appropriate for an EMACS_INT. */
+#if SIZEOF_EMACS_INT == SIZEOF_INT
+# define EMACS_INT_ABS abs
+#elif SIZEOF_EMACS_INT == SIZEOF_LONG
+# define EMACS_INT_ABS labs
+#elif SIZEOF_EMACS_INT == SIZEOF_LONG_LONG
+# define EMACS_INT_ABS llabs
+#endif
+
/* -------------------------- basic byte typedefs --------------------- */
/* The definitions we put here and in the next section use typedefs to
diff -r 7ce0eaac52e01c1f46b35f8a36d08abcd3bbc0a6 -r c8b7adfa23c6f68a106755cc970296763c2ed59d tests/ChangeLog
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-11 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/lisp-tests.el:
+ Check for the %-equivalence documented in the C standard for
+ bignums too.
+
2017-11-07 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/mule-tests.el:
diff -r 7ce0eaac52e01c1f46b35f8a36d08abcd3bbc0a6 -r c8b7adfa23c6f68a106755cc970296763c2ed59d tests/automated/lisp-tests.el
--- a/tests/automated/lisp-tests.el
+++ b/tests/automated/lisp-tests.el
@@ -757,7 +757,22 @@
(= (% big (1+ most-positive-fixnum)) most-positive-fixnum)
(= (% negbig (1- most-negative-fixnum)) most-negative-fixnum)
(= (mod big (1+ most-positive-fixnum)) most-positive-fixnum)
- (= (mod negbig (1- most-negative-fixnum)) most-negative-fixnum)))
+ (= (mod negbig (1- most-negative-fixnum)) most-negative-fixnum))
+
+ (macrolet
+ ((check-%-for-value (value denominator)
+ `(Assert (eql ,value
+ (+ (* (/ ,value ,denominator) ,denominator)
+ (% ,value ,denominator))))))
+ (let ((limit (* most-positive-fixnum 2)) random-value random-denominator)
+ (dotimes (i 10) ;; Increase these COUNTs to reassure.
+ (dotimes (j 4)
+ (setq random-value (random limit)
+ random-denominator (random limit))
+ (check-%-for-value random-value random-denominator)
+ (check-%-for-value (- random-value) random-denominator)
+ (check-%-for-value random-value (- random-denominator))
+ (check-%-for-value (- random-value) (- random-denominator)))))))
;;-----------------------------------------------------
;; Arithmetic comparison operations
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.
commit/cc-mode: acm: Correct the indentation of C99's compound
literals.
7 years, 1 month
Bitbucket
1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/655ca3305b88/
Changeset: 655ca3305b88
User: acm
Date: 2017-11-10 17:32:55+00:00
Summary: Correct the indentation of C99's compound literals.
* cc-engine.el (c-looking-at-statement-block): Amend so that if there is only
syntactic whitespace in a brace block, it is regarded as a statement block.
Also, if there is no semicolon or comma delimiter, treat as a statement block
when there is a keyword.
(c-guess-basic-syntax): CASE 9 test: Regard a brace as starting a brace block
when its contents indicate a brace block.
Affected #: 1 file
diff -r e1adcfb5afda08fc5cae38d673e756fd5023c8b1 -r 655ca3305b88fefc49a564bf97340b65da01da8f cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -10735,26 +10735,35 @@
(defun c-looking-at-statement-block ()
;; Point is at an opening brace. If this is a statement block (i.e. the
- ;; elements in it are terminated by semicolons) return t. Otherwise, return
- ;; nil.
+ ;; elements in the block are terminated by semicolons, or the block is
+ ;; empty, or the block contains a keyword) return t. Otherwise, return nil.
(let ((here (point)))
(prog1
(if (c-go-list-forward)
(let ((there (point)))
(backward-char)
- (c-syntactic-skip-backward
- "^;," here t)
+ (c-syntactic-skip-backward "^;," here t)
(cond
((eq (char-before) ?\;) t)
((eq (char-before) ?,) nil)
- (t (goto-char here)
- (forward-char)
- (and (c-syntactic-re-search-forward "{" there t t)
- (progn (backward-char)
- (c-looking-at-statement-block))))))
+ (t ; We're at (1+ here).
+ (cond
+ ((progn (c-forward-syntactic-ws)
+ (eq (point) (1- there)))
+ t)
+ ((c-syntactic-re-search-forward c-keywords-regexp there t)
+ t)
+ ((c-syntactic-re-search-forward "{" there t t)
+ (backward-char)
+ (c-looking-at-statement-block))
+ (t nil)))))
(forward-char)
- (and (c-syntactic-re-search-forward "[;,]" nil t t)
- (eq (char-before) ?\;)))
+ (cond
+ ((c-syntactic-re-search-forward "[;,]" nil t t)
+ (eq (char-before) ?\;))
+ ((c-syntactic-re-search-forward c-keywords-regexp nil t t)
+ t)
+ (t nil)))
(goto-char here))))
(defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end)
@@ -12546,7 +12555,11 @@
(save-excursion
(goto-char containing-sexp)
(c-looking-at-special-brace-list)))
- (c-inside-bracelist-p containing-sexp paren-state t))))
+ (c-inside-bracelist-p containing-sexp paren-state t)
+ (save-excursion
+ (goto-char containing-sexp)
+ (and (eq (char-after) ?{)
+ (not (c-looking-at-statement-block)))))))
(cond
;; CASE 9A: In the middle of a special brace list opener.
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.
commit/XEmacs: kehoea: Fix the build #ifdef CCL_DEBUG.
7 years, 1 month
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/7ce0eaac52e0/
Changeset: 7ce0eaac52e0
User: kehoea
Date: 2017-11-09 21:59:49+00:00
Summary: Fix the build #ifdef CCL_DEBUG.
src/ChangeLog addition:
2017-11-09 Aidan Kehoe <kehoea(a)parhasard.net>
* mule-ccl.c (ccl_driver):
Fix the build #ifdef CCL_DEBUG.
Affected #: 2 files
diff -r 1c9b5a16e78274b6b671f85a57b9f7c88a952115 -r 7ce0eaac52e01c1f46b35f8a36d08abcd3bbc0a6 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-09 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * mule-ccl.c (ccl_driver):
+ Fix the build #ifdef CCL_DEBUG.
+
2017-11-07 Aidan Kehoe <kehoea(a)parhasard.net>
Quieten some compiler warnings:
diff -r 1c9b5a16e78274b6b671f85a57b9f7c88a952115 -r 7ce0eaac52e01c1f46b35f8a36d08abcd3bbc0a6 src/mule-ccl.c
--- a/src/mule-ccl.c
+++ b/src/mule-ccl.c
@@ -2020,7 +2020,7 @@
EMACS_INT i = ccl_backtrace_idx - 1;
EMACS_INT j;
- Dynarr_add_many (destination, (unsigned char *) msg, strlen (msg));
+ Dynarr_add_many (destination, (unsigned char *) msg, qxestrlen (msg));
for (j = 0; j < CCL_DEBUG_BACKTRACE_LEN; j++, i--)
{
@@ -2029,7 +2029,7 @@
break;
Dynarr_add_many (destination, msg,
emacs_snprintf (msg, sizeof (msg),
- " %ld", ccl_backtrace_table[i]))
+ " %ld", ccl_backtrace_table[i]));
}
goto ccl_finish;
}
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.
commit/XEmacs: kehoea: Parse UnicodeData.txt instead of
CaseFolding.txt for mule/uni-case-conv.el
7 years, 1 month
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/1c9b5a16e782/
Changeset: 1c9b5a16e782
User: kehoea
Date: 2017-11-09 21:47:32+00:00
Summary: Parse UnicodeData.txt instead of CaseFolding.txt for mule/uni-case-conv.el
lisp/ChangeLog addition:
2017-11-09 Aidan Kehoe <kehoea(a)parhasard.net>
Ben's approach in lib-src/make-case-conv.el didn't work, there are
107 entries in CaseFolding.txt as of today where the first column
is a lowercase letter, not an uppercase one. Parse UnicodeData.txt
instead.
* mule/make-case-conv.el: New.
Replacement for lib-src/make-case-conv.py, parsing UnicodeData.txt
instead.
* mule/uni-case-conv.el:
Update this file to reflect output from make-case-conv.el with
recent UnicodeData.txt instead.
lib-src/ChangeLog addition:
2017-11-09 Aidan Kehoe <kehoea(a)parhasard.net>
* make-case-conv.py:
Document why this file's approach didn't work. Slot it for deletion.
Affected #: 5 files
diff -r 52af36c1d4781c2bce577f240c75f9d67cd5c2f5 -r 1c9b5a16e78274b6b671f85a57b9f7c88a952115 lib-src/ChangeLog
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-09 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * make-case-conv.py:
+ Document why this file's approach didn't work. Slot it for deletion.
+
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* b2m.c (main):
diff -r 52af36c1d4781c2bce577f240c75f9d67cd5c2f5 -r 1c9b5a16e78274b6b671f85a57b9f7c88a952115 lib-src/make-case-conv.py
--- a/lib-src/make-case-conv.py
+++ b/lib-src/make-case-conv.py
@@ -35,6 +35,12 @@
# (or whatever else you have named it according to the variable
# `output_filename').
+# #### Aidan Kehoe, Do 9 Nov 2017 21:32:14 GMT; this approach doesn't work,
+# since CaseFolding folds both upper and lower case characters to lower case,
+# without marking which is which. We need to parse UnicodeData.txt instead; I
+# do this in lisp/mule/make-case-conv.el. I will remove make-case-conv.py down
+# the line.
+
### Code:
import urllib2, re, sys
diff -r 52af36c1d4781c2bce577f240c75f9d67cd5c2f5 -r 1c9b5a16e78274b6b671f85a57b9f7c88a952115 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
+2017-11-09 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ Ben's approach in lib-src/make-case-conv.el didn't work, there are
+ 107 entries in CaseFolding.txt as of today where the first column
+ is a lowercase letter, not an uppercase one. Parse UnicodeData.txt
+ instead.
+
+ * mule/make-case-conv.el: New.
+ Replacement for lib-src/make-case-conv.py, parsing UnicodeData.txt
+ instead.
+ * mule/uni-case-conv.el:
+ Update this file to reflect output from make-case-conv.el with
+ recent UnicodeData.txt instead.
+
2017-10-29 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-extra.el (cl-macroexpand-all):
diff -r 52af36c1d4781c2bce577f240c75f9d67cd5c2f5 -r 1c9b5a16e78274b6b671f85a57b9f7c88a952115 lisp/mule/make-case-conv.el
--- /dev/null
+++ b/lisp/mule/make-case-conv.el
@@ -0,0 +1,151 @@
+;;; uni-case-conv.el --- Case-conversion support for Unicode
+
+;; Copyright (C) 2017 Free Software Foundation, (C) 2010 Ben Wing
+
+;; Keywords: multilingual, case, uppercase, lowercase, Unicode
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Commentary:
+
+;; Generate uni-case-conv.el. To do this, parse the UnicodeData.txt file. Do
+;; not parse CaseFolding.txt, since it does not mark the case of the character
+;; to be folded (a lower case character can be folded to a lower case
+;; character, which is an issue at least for ?\u00b5 MICRO SIGN). This will
+;; need to be replaced once we have better case support (once we attempt to
+;; support SpecialCasing.txt.) This only needs to be done when UnicodeData.txt
+;; is updated. First commit reflects UnicodeData.txt of 20160517, md5 sum
+;; dde25b1cf9bbb4ba1140ac12e4128b0b.
+
+;; Based on Ben's make-case-conv.py, which parsed CaseFolding.txt rather than
+;; UnicodeData.txt
+
+(require 'descr-text)
+
+(let* ((output-filename "uni-case-conv.el")
+ (output-buffer (get-buffer-create output-filename))
+ (mapping (make-hash-table :test #'eql))
+ case-fold-search lower upper)
+ (format-into output-buffer
+ #r";;; %s --- Case-conversion support for Unicode
+
+;; Copyright (C) 2010 Ben Wing.
+
+;; Keywords: multilingual, case, uppercase, lowercase, Unicode
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Commentary:
+
+;; DO NOT MODIFY THIS FILE!!!!!!!!!!!!!!!!
+;; This file is autogenerated by %s. Modify that
+;; file instead.
+
+;;; Code:
+
+;; We process UnicodeData.txt in reverse order so that the more
+;; desirable mappings, which come early, override less desirable later ones.
+;; In particular, we definitely do not want the following bindings to work
+;; both ways:
+
+;; (?\u017F ?\u0073) ;; LATIN SMALL LETTER LONG S
+;; (?\u212A ?\u006B) ;; KELVIN SIGN
+;; (?\u212B ?\u00E5) ;; ANGSTROM SIGN
+
+;; The first two are especially bad as they will cause upcasing operations
+;; on lowercase s and k to give strange results. It's actually worse than
+;; that -- for unknown reasons, with the bad mappings in place, the byte-
+;; compiler produces broken code for some files, which results in a stack-
+;; underflow crash upon loadup in preparation for dumping.
+" output-filename (subseq (file-name-nondirectory load-file-name) 0
+ (if (eql (aref load-file-name
+ (1- (length load-file-name)))
+ ?c)
+ -1)))
+ ;; This is a separate call just for the sake of indentation, so we don't
+ ;; have a ?( in the first column.
+ (write-sequence "(loop
+ for (upper lower)
+ in '(" output-buffer)
+ (labels ((tounichar (value)
+ (format (if (<= value #xFFFF) #r"?\u%04X" #r"?\U%08X") value))
+ (choose-comment (upper lower)
+ (let* ((upper-comment
+ (cadr (assoc "Name" (describe-char-unicode-data upper))))
+ (lower-comment
+ (cadr (assoc "Name" (describe-char-unicode-data lower))))
+ (folded-upper-comment
+ (replace-in-string upper-comment " CAPITAL LETTER " "" t)))
+ (if (equal folded-upper-comment
+ (replace-in-string
+ lower-comment " SMALL LETTER " "" t))
+ (replace-in-string lower-comment
+ " SMALL LETTER " " LETTER " t)
+ (concat upper-comment ", " lower-comment)))))
+ (with-temp-buffer
+ (insert-file-contents describe-char-unicodedata-file nil)
+ (goto-char (point-max))
+ (while (re-search-backward #r"
+\([0-9A-F]+\);[^;]+;\(L[lu]\);\([^;]*;\)\{9,9\}\([^;]*\);\([^;]*\);" nil t)
+ (if (equal (match-string 2) "Ll")
+ (when (> (- (match-end 4) (match-beginning 4)) 0)
+ (setq lower (parse-integer (match-string 1) :radix 16)
+ upper (parse-integer (match-string 4) :radix 16))
+ (when (equal (cadr (assoc "Category" (describe-char-unicode-data upper)))
+ "uppercase letter")
+ (format-into output-buffer "(%s %s) ;; %s\n "
+ (tounichar upper) (tounichar lower)
+ (choose-comment upper lower))
+ (puthash upper lower mapping)))
+ (when (> (- (match-end 5) (match-beginning 5)) 0)
+ (setq upper (parse-integer (match-string 1) :radix 16)
+ lower (parse-integer (match-string 5) :radix 16))
+ ;; We will generally encounter the lower-case characters first.
+ (unless (eql (gethash upper mapping) lower)
+ (when (equal (cadr (assoc "Category" (describe-char-unicode-data lower)))
+ "lowercase letter")
+ (format-into output-buffer "(%s %s) ;; %s\n "
+ (tounichar upper) (tounichar lower)
+ (choose-comment upper lower))
+ (puthash upper lower mapping))))))
+ (format-into output-buffer ")
+ with case-table = (standard-case-table)
+ do
+ (put-case-table-pair upper lower case-table))
+
+\(provide '%.*s)
+
+;;; %s ends here
+" (position ?. output-filename :from-end t) output-filename output-filename))))
+
+;; make-case-conv.el ends here
This diff is so big that we needed to truncate the remainder.
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.
commit/cc-mode: acm: Correctly indent C++14 brace lists which are a
second argument to a function.
7 years, 1 month
Bitbucket
1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/e1adcfb5afda/
Changeset: e1adcfb5afda
User: acm
Date: 2017-11-09 18:20:46+00:00
Summary: Correctly indent C++14 brace lists which are a second argument to a function.
In particular, don't indent contained brace lists in "staircase" fashion.
This fixes bug #28623.
* cc-engine.el (c-looking-at-or-maybe-in-bracelist): When testing for being
enclosed in parens, recognise also a brace directly following a comma, as well
as a brace being the first thing inside the paren. Enhance the return value,
by indicating when we're directly inside an open paren.
(c-inside-bracelist-p): Add an extra argument ACCEPT-IN-PARAM which indicates
whether we will accept a bracelist directly inside an open parenthesis.
Simplify the manipulation of PAREN-STATE by dispensing with variable LIM and
using c-pull-open-brace. Enhance the return value, respecting the new
argument.
(c-guess-basic-syntax): Save a copy of the initial parse-state in the new
variable STATE-CACHE. Use this variable in place of C-STATE-CACHE throughout
the function. At CASE 7B, call c-inside-bracelist-p with extra argument nil.
At CASE 9, call that function with extra argument t.
Affected #: 1 file
diff -r c4233994df9a33d8455917fb88c16c1492402ab0 -r e1adcfb5afda08fc5cae38d673e756fd5023c8b1 cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -10416,16 +10416,20 @@
(defun c-looking-at-or-maybe-in-bracelist (&optional containing-sexp lim)
;; Point is at an open brace. If this starts a brace list, return a list
;; whose car is the buffer position of the start of the construct which
- ;; introduces the list, and whose cdr is t if we have parsed a keyword
- ;; matching `c-opt-inexpr-brace-list-key' (e.g. Java's "new"), nil
- ;; otherwise. Otherwise, if point might be inside an enclosing brace list,
- ;; return t. If point is definitely neither at nor in a brace list, return
- ;; nil.
+ ;; introduces the list, and whose cdr is the symbol `in-paren' if the brace
+ ;; is directly enclosed in a parenthesis form (i.e. an arglist), t if we
+ ;; have parsed a keyword matching `c-opt-inexpr-brace-list-key' (e.g. Java's
+ ;; "new"), nil otherwise. Otherwise, if point might be inside an enclosing
+ ;; brace list, return t. If point is definitely neither at nor in a brace
+ ;; list, return nil.
;;
;; CONTAINING-SEXP is the position of the brace/paren/braacket enclosing
;; POINT, or nil if there is no such position, or we do not know it. LIM is
;; a backward search limit.
;;
+ ;; The determination of whether the brace starts a brace list is solely by
+ ;; the context of the brace, not by its contents.
+ ;;
;; Here, "brace list" does not include the body of an enum.
(save-excursion
(let ((start (point))
@@ -10435,17 +10439,20 @@
(and (c-major-mode-is 'pike-mode)
c-decl-block-key))
(braceassignp 'dontknow)
- inexpr-brace-list bufpos macro-start res pos after-type-id-pos)
+ inexpr-brace-list bufpos macro-start res pos after-type-id-pos
+ in-paren)
(setq res (c-backward-token-2 1 t lim))
;; Checks to do only on the first sexp before the brace.
- ;; Have we a C++ initialisation, without an "="?
+ ;; Have we a C++ initialization, without an "="?
(if (and (c-major-mode-is 'c++-mode)
(cond
- ((and (not (eq res 0))
+ ((and (or (not (eq res 0))
+ (eq (char-after) ?,))
(c-go-up-list-backward nil lim) ; FIXME!!! Check ; `lim' 2016-07-12.
(eq (char-after) ?\())
- (setq braceassignp 'c++-noassign))
+ (setq braceassignp 'c++-noassign
+ in-paren 'in-paren))
((looking-at c-pre-id-bracelist-key))
((looking-at c-return-key))
((and (looking-at c-symbol-start)
@@ -10454,9 +10461,11 @@
(t nil))
(save-excursion
(cond
- ((not (eq res 0))
+ ((or (not (eq res 0))
+ (eq (char-after) ?,))
(and (c-go-up-list-backward nil lim) ; FIXME!!! Check `lim' 2016-07-12.
- (eq (char-after) ?\()))
+ (eq (char-after) ?\()
+ (setq in-paren 'in-paren)))
((looking-at c-pre-id-bracelist-key))
((looking-at c-return-key))
(t (setq after-type-id-pos (point))
@@ -10495,7 +10504,7 @@
(c-backward-syntactic-ws)
(eq (char-before) ?\()))
;; Single identifier between '(' and '{'. We have a bracelist.
- (cons after-type-id-pos nil))
+ (cons after-type-id-pos 'in-paren))
(t
(goto-char pos)
@@ -10553,7 +10562,7 @@
(braceassignp
;; We've hit the beginning of the aggregate list.
(c-beginning-of-statement-1 containing-sexp)
- (cons (point) inexpr-brace-list))
+ (cons (point) (or in-paren inexpr-brace-list)))
((and after-type-id-pos
(save-excursion
(when (eq (char-after) ?\;)
@@ -10578,7 +10587,7 @@
nil nil))
(and (consp res)
(eq (car res) after-type-id-pos))))))
- (cons bufpos inexpr-brace-list))
+ (cons bufpos (or in-paren inexpr-brace-list)))
((eq (char-after) ?\;)
;; Brace lists can't contain a semicolon, so we're done.
;; (setq containing-sexp nil)
@@ -10602,12 +10611,16 @@
(t t)))) ;; The caller can go up one level.
)))
-(defun c-inside-bracelist-p (containing-sexp paren-state)
+(defun c-inside-bracelist-p (containing-sexp paren-state accept-in-paren)
;; return the buffer position of the beginning of the brace list
;; statement if we're inside a brace list, otherwise return nil.
;; CONTAINING-SEXP is the buffer pos of the innermost containing
;; paren. PAREN-STATE is the remainder of the state of enclosing
- ;; braces
+ ;; braces. ACCEPT-IN-PAREN is non-nil iff we will accept as a brace
+ ;; list a brace directly enclosed in a parenthesis.
+ ;;
+ ;; The "brace list" here is recognized solely by its context, not by
+ ;; its contents.
;;
;; N.B.: This algorithm can potentially get confused by cpp macros
;; placed in inconvenient locations. It's a trade-off we make for
@@ -10622,17 +10635,11 @@
;; this will pick up array/aggregate init lists, even if they are nested.
(save-excursion
(let ((bufpos t)
- lim next-containing)
+ next-containing)
(while (and (eq bufpos t)
containing-sexp)
(when paren-state
- (if (consp (car paren-state))
- (setq lim (cdr (car paren-state))
- paren-state (cdr paren-state))
- (setq lim (car paren-state)))
- (when paren-state
- (setq next-containing (car paren-state)
- paren-state (cdr paren-state))))
+ (setq next-containing (c-pull-open-brace paren-state)))
(goto-char containing-sexp)
(if (c-looking-at-inexpr-block next-containing next-containing)
@@ -10641,14 +10648,16 @@
;; containing sexp, so that c-looking-at-inexpr-block
;; doesn't check for an identifier before it.
(setq bufpos nil)
- (when (or (not (eq (char-after) ?{))
- (eq (setq bufpos (c-looking-at-or-maybe-in-bracelist
- next-containing lim))
- t))
- (setq containing-sexp next-containing
- lim nil
- next-containing nil))))
- (and (consp bufpos) (car bufpos))))))
+ (if (not (eq (char-after) ?{))
+ (setq bufpos nil)
+ (when (eq (setq bufpos (c-looking-at-or-maybe-in-bracelist
+ next-containing next-containing))
+ t)
+ (setq containing-sexp next-containing
+ next-containing nil)))))
+ (and (consp bufpos)
+ (or accept-in-paren (not (eq (cdr bufpos) 'in-paren)))
+ (car bufpos))))))
(defun c-looking-at-special-brace-list (&optional lim)
;; If we're looking at the start of a pike-style list, i.e., `({ })',
@@ -11515,6 +11524,7 @@
;; The paren state outside `containing-sexp', or at
;; `indent-point' if `containing-sexp' is nil.
(paren-state (c-parse-state))
+ (state-cache (copy-tree paren-state))
;; There's always at most one syntactic element which got
;; an anchor pos. It's stored in syntactic-relpos.
syntactic-relpos
@@ -11677,7 +11687,7 @@
(not (c-at-vsemi-p before-ws-ip))
(not (memq char-after-ip '(?\) ?\] ?,)))
(or (not (eq char-before-ip ?}))
- (c-looking-at-inexpr-block-backward c-state-cache))
+ (c-looking-at-inexpr-block-backward state-cache))
(> (point)
(progn
;; Ought to cache the result from the
@@ -11755,7 +11765,7 @@
(if containing-sexp
(progn
(goto-char containing-sexp)
- (setq lim (c-most-enclosing-brace c-state-cache
+ (setq lim (c-most-enclosing-brace state-cache
containing-sexp))
(c-backward-to-block-anchor lim)
(c-add-stmt-syntax 'case-label nil t lim paren-state))
@@ -11781,7 +11791,7 @@
(containing-sexp
(goto-char containing-sexp)
- (setq lim (c-most-enclosing-brace c-state-cache
+ (setq lim (c-most-enclosing-brace state-cache
containing-sexp))
(save-excursion
(setq tmpsymbol
@@ -11825,7 +11835,7 @@
(goto-char (cdr placeholder))
(back-to-indentation)
(c-add-stmt-syntax tmpsymbol nil t
- (c-most-enclosing-brace c-state-cache (point))
+ (c-most-enclosing-brace state-cache (point))
paren-state)
(unless (eq (point) (cdr placeholder))
(c-add-syntax (car placeholder))))
@@ -12248,11 +12258,11 @@
(and (eq (char-before) ?})
(save-excursion
(let ((start (point)))
- (if (and c-state-cache
- (consp (car c-state-cache))
- (eq (cdar c-state-cache) (point)))
+ (if (and state-cache
+ (consp (car state-cache))
+ (eq (cdar state-cache) (point)))
;; Speed up the backward search a bit.
- (goto-char (caar c-state-cache)))
+ (goto-char (caar state-cache)))
(c-beginning-of-decl-1 containing-sexp) ; Can't use `lim' here.
(setq placeholder (point))
(if (= start (point))
@@ -12412,7 +12422,8 @@
((and (eq char-after-ip ?{)
(progn
(setq placeholder (c-inside-bracelist-p (point)
- paren-state))
+ paren-state
+ nil))
(if placeholder
(setq tmpsymbol '(brace-list-open . inexpr-class))
(setq tmpsymbol '(block-open . inexpr-statement)
@@ -12494,7 +12505,7 @@
(skip-chars-forward " \t"))
(goto-char placeholder))
(c-add-stmt-syntax 'arglist-cont-nonempty (list containing-sexp) t
- (c-most-enclosing-brace c-state-cache (point))
+ (c-most-enclosing-brace state-cache (point))
paren-state))
;; CASE 7G: we are looking at just a normal arglist
@@ -12535,7 +12546,7 @@
(save-excursion
(goto-char containing-sexp)
(c-looking-at-special-brace-list)))
- (c-inside-bracelist-p containing-sexp paren-state))))
+ (c-inside-bracelist-p containing-sexp paren-state t))))
(cond
;; CASE 9A: In the middle of a special brace list opener.
@@ -12583,7 +12594,7 @@
(= (point) containing-sexp)))
(if (eq (point) (c-point 'boi))
(c-add-syntax 'brace-list-close (point))
- (setq lim (c-most-enclosing-brace c-state-cache (point)))
+ (setq lim (c-most-enclosing-brace state-cache (point)))
(c-beginning-of-statement-1 lim nil nil t)
(c-add-stmt-syntax 'brace-list-close nil t lim paren-state)))
@@ -12609,7 +12620,7 @@
(goto-char containing-sexp))
(if (eq (point) (c-point 'boi))
(c-add-syntax 'brace-list-intro (point))
- (setq lim (c-most-enclosing-brace c-state-cache (point)))
+ (setq lim (c-most-enclosing-brace state-cache (point)))
(c-beginning-of-statement-1 lim)
(c-add-stmt-syntax 'brace-list-intro nil t lim paren-state)))
@@ -12631,7 +12642,7 @@
((and (not (memq char-before-ip '(?\; ?:)))
(not (c-at-vsemi-p before-ws-ip))
(or (not (eq char-before-ip ?}))
- (c-looking-at-inexpr-block-backward c-state-cache))
+ (c-looking-at-inexpr-block-backward state-cache))
(> (point)
(save-excursion
(c-beginning-of-statement-1 containing-sexp)
@@ -12765,7 +12776,7 @@
(skip-chars-forward " \t"))
(goto-char placeholder))
(c-add-stmt-syntax 'template-args-cont (list containing-<) t
- (c-most-enclosing-brace c-state-cache (point))
+ (c-most-enclosing-brace state-cache (point))
paren-state))
;; CASE 17: Statement or defun catchall.
@@ -12839,7 +12850,7 @@
(goto-char (cdr placeholder))
(back-to-indentation)
(c-add-stmt-syntax tmpsymbol nil t
- (c-most-enclosing-brace c-state-cache (point))
+ (c-most-enclosing-brace state-cache (point))
paren-state)
(if (/= (point) (cdr placeholder))
(c-add-syntax (car placeholder))))
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.