[COMMIT] Whitespace cleanup
13 years, 7 months
Didier Verna
NOTE: This patch has been committed.
xemacs-packages/prog-modes/ChangeLog addition:
2011-05-15 Didier Verna <didier(a)xemacs.org>
* cl-indent.el (common-lisp-indent-function-1):
* cl-indent.el (lisp-lambda-list-keyword-parameter-column):
Whitespace cleanup.
XEmacs Packages source patch:
Diff command: cvs -q diff -u
Files affected: xemacs-packages/prog-modes/cl-indent.el
Index: xemacs-packages/prog-modes/cl-indent.el
===================================================================
RCS file: /cvsroot/xemacs/XEmacs/packages/xemacs-packages/prog-modes/cl-indent.el,v
retrieving revision 1.10
diff -u -u -r1.10 cl-indent.el
--- xemacs-packages/prog-modes/cl-indent.el 15 May 2011 11:42:05 -0000 1.10
+++ xemacs-packages/prog-modes/cl-indent.el 15 May 2011 11:53:25 -0000
@@ -302,15 +302,15 @@
;; No indentation for "'(...)" elements
(setq calculated (1+ sexp-column)))
((save-excursion
- (goto-char indent-point)
- (backward-sexp)
- (let ((xxx (buffer-substring-no-properties
- (point) (+ (point) 3))))
- (and (eq ?\# (elt xxx 0))
- (or (member (elt xxx 1) '(?\+ ?\-))
- (and (eq ?\! (elt xxx 1))
- (member (elt xxx 2) '(?\+ ?\-)))))))
- normal-indent)
+ (goto-char indent-point)
+ (backward-sexp)
+ (let ((xxx (buffer-substring-no-properties
+ (point) (+ (point) 3))))
+ (and (eq ?\# (elt xxx 0))
+ (or (member (elt xxx 1) '(?\+ ?\-))
+ (and (eq ?\! (elt xxx 1))
+ (member (elt xxx 2) '(?\+ ?\-)))))))
+ normal-indent)
((eq (char-after (1- containing-sexp)) ?\#)
;; "#(...)"
(setq calculated (1+ sexp-column)))
@@ -424,7 +424,7 @@
"Return the indentation column of a keyword parameter in a lambda-list.
The corresponding keyword is searched from END back across s-expressions.
If not found, return nil. Otherwise, return the appropriate column,
-according to `lisp-lambda-list-keyword-parameter-indentation' and
+according to `lisp-lambda-list-keyword-parameter-indentation' and
`lisp-lambda-list-keyword-parameter-alignment'."
(save-excursion
(goto-char end)
--
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Support indentation within destructuring lambda-lists
13 years, 7 months
Didier Verna
NOTE: This patch has been committed.
xemacs-packages/prog-modes/ChangeLog addition:
2011-05-15 Didier Verna <didier(a)xemacs.org>
* cl-indent.el (lisp-indent-259): Also call
lisp-indent-lambda-list within a destructured one.
XEmacs Packages source patch:
Diff command: cvs -q diff -u
Files affected: xemacs-packages/prog-modes/cl-indent.el
Index: xemacs-packages/prog-modes/cl-indent.el
===================================================================
RCS file: /cvsroot/xemacs/XEmacs/packages/xemacs-packages/prog-modes/cl-indent.el,v
retrieving revision 1.9
diff -u -u -r1.9 cl-indent.el
--- xemacs-packages/prog-modes/cl-indent.el 12 May 2011 12:19:40 -0000 1.9
+++ xemacs-packages/prog-modes/cl-indent.el 15 May 2011 11:39:50 -0000
@@ -540,15 +540,13 @@
(throw 'exit
(cond ((null p)
(list (+ sexp-column 4) containing-form-start))
- ((null (cdr p))
+ (t
;; Indentation within a lambda-list. -- dvl
(list (lisp-indent-lambda-list
indent-point
sexp-column
containing-form-start)
- containing-form-start))
- (t
- normal-indent))))
+ containing-form-start)))))
((integerp tem)
(throw 'exit
(if (null p) ;not in subforms
--
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
Re: just not familiar with the environment yet
13 years, 7 months
Aidan Kehoe
Ar an naoiú lá de mí Bealtaine, scríobh Stephen J. Turnbull:
> Aidan Kehoe writes:
>
> > http://mid.gmane.org/19902.32968.993055.512591@parhasard.net ; can we go
> > ahead and require a recent makeinfo for our docs?
>
> How recent do you need?
4.9 might do, 4.8 definitely won’t work, 4.13 definitely will work.
> Mac OS X "Leopard" has 4.8. MacPorts bumps that to 4.13, but a lot of
> people don't seem to like MacPorts.
>
> I don't know about Snow Leopard. Still, the Mac people we have seem to be
> very aggressive about being on the bleeding edge, and I doubt very many
> are using Leopard any more.
I’m emphatically not very aggressive about being on the bleeding edge, and
am still using 10.4. (I use and value the bluetooth connection on my
machine, and at the point Leopard was released all the information I could
find said it would no longer work, but now I look again that may not be the
case; personal experience welcome.) But I have MacPorts.
> Gentoo and Debian stable have 4.13.
>
> So I guess I don't really have a problem with a more recent
> requirement in 21.5, as long as Cygwin or MSYS (preferably MSYS, some
> people don't like the Cygwin dependency, but I can live with requiring
> that, I suppose) have that version available. If people really have a
> problem, I can always start building info tarballs for the betas.
OK, absent any contradictions I’ll go ahead with it in a few days.
> I'd like to hear from some of the other folks, though, especially Vin
> and the Solaris testers.
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Merge, restoring Ben's GPLv3 manual changes.
13 years, 7 months
Aidan Kehoe
changeset: 5508:3fe8358ad59a
tag: tip
parent: 5506:b0d87f92e60b
parent: 5507:64be8a494bdc
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Mon May 09 20:47:31 2011 +0100
files: man/ChangeLog man/Makefile man/texinfo.tex man/texinfo.texi
description:
Merge, restoring Ben's GPLv3 manual changes.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Handle SBCL's &more lambda-list keyword
13 years, 7 months
Didier Verna
NOTE: This patch has been committed.
Subject sezidall.
xemacs-packages/prog-modes/ChangeLog addition:
2011-05-12 Didier Verna <didier(a)xemacs.org>
From Nikodemus Siivola.
* cl-indent.el (lisp-indent-lambda-list-keywords-regexp): Support
SBCL's &more lambda-list argument.
XEmacs Packages source patch:
Diff command: cvs -q diff -u
Files affected: xemacs-packages/prog-modes/cl-indent.el
Index: xemacs-packages/prog-modes/cl-indent.el
===================================================================
RCS file: /cvsroot/xemacs/XEmacs/packages/xemacs-packages/prog-modes/cl-indent.el,v
retrieving revision 1.8
diff -u -u -r1.8 cl-indent.el
--- xemacs-packages/prog-modes/cl-indent.el 12 May 2011 12:14:13 -0000 1.8
+++ xemacs-packages/prog-modes/cl-indent.el 12 May 2011 12:18:45 -0000
@@ -394,7 +394,7 @@
(defvar lisp-indent-lambda-list-keywords-regexp
"&\\(\
optional\\|rest\\|key\\|allow-other-keys\\|aux\\|whole\\|body\\|environment\
-\\)\\([ \t]\\|$\\)"
+\\|more\\)\\([ \t]\\|$\\)"
"Regular expression matching lambda-list keywords.")
;; #### NOTE: the two functions below won't handle the presence of comments
--
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Another batch of improvements for cl-indent.el
13 years, 7 months
Didier Verna
NOTE: This patch has been committed.
Another round of improvements to Common Lisp indentation. Most notably
includes proper indentation of LOOP.
xemacs-packages/prog-modes/ChangeLog addition:
2011-05-11 Didier Verna <didier(a)xemacs.org>
* cl-indent.el: Subclause-aware loop indentation from Slime.
(lisp-indent-loop-subclauses): New customizable user option.
(common-lisp-indent-function): Trampoline directly to
common-lisp-indent-function-1. Loop indentation is now picked up
by the normal machinery instead of being special-case'd here.
(lisp-indent-loop): New function. Choose between the old naive
indentation and the new subclause-aware version based on
lisp-indent-loop-subclauses.
(common-lisp-indent-body-introducing-loop-macro-keyword):
(common-lisp-indent-prefix-loop-macro-keyword):
(common-lisp-indent-clause-joining-loop-macro-keyword):
(common-lisp-indent-indented-loop-macro-keyword):
(common-lisp-indent-indenting-loop-macro-keyword):
(common-lisp-indent-loop-macro-else-keyword): New variables.
Regular expressions for identifying loop parts.
(common-lisp-indent-parse-state-depth):
(common-lisp-indent-parse-state-start):
(common-lisp-indent-parse-state-prev): New functions. Parse state
accessors.
(common-lisp-indent-loop-macro-1): New function. Subclause aware
loop indentation.
(common-lisp-indent-loop-advance-past-keyword-on-line): Utility
used by the above.
2011-05-11 Didier Verna <didier(a)xemacs.org>
From Nikodemus Siivola.
* cl-indent.el (common-lisp-loop-type): New function. Replaces
extended-loop-p.
(common-lisp-loop-part-indentation): Use common-lisp-loop-type to
decide how to indent, supporting both "split" and "unsplit"
styles.
(lisp-loop-keyword-indentation):
(lisp-loop-forms-indentation): Deleted. Pointless now that both
split and unsplit styles work automatically.
(extended-loop-p): Deleted.
(lisp-simple-loop-indentation): Change default to 2.
(common-lisp-loop-part-indentation): Return (<indent>
<loop-start>) instead of <indent> for non-simple loops. This lets
calculate-lisp-indent know that the following lines of the loop
might be indented differently, fixing indent-sexp for loops.
(common-lisp-indent-function-1): Remove bogus special casing of
,(...) and ,@(...). Even if backquote was being indented as data,
the escaped forms are evaluated, and hence should be indented as
lisp code.
(lisp-indent-259): Don't throw to exit with normal-indent if
processing a tail that isn't a cons. Doing that breaks (... &rest
foo) specs.
(common-lisp-indent-function-1): Don't take `default' for a
tentative defun, unlike anything else starting with `def'.
XEmacs Packages source patch:
Diff command: cvs -q diff -u
Files affected: xemacs-packages/prog-modes/cl-indent.el
Index: xemacs-packages/prog-modes/cl-indent.el
===================================================================
RCS file: /cvsroot/xemacs/XEmacs/packages/xemacs-packages/prog-modes/cl-indent.el,v
retrieving revision 1.5
diff -u -u -r1.5 cl-indent.el
--- xemacs-packages/prog-modes/cl-indent.el 11 May 2011 13:33:12 -0000 1.5
+++ xemacs-packages/prog-modes/cl-indent.el 11 May 2011 13:36:56 -0000
@@ -25,7 +25,10 @@
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Synched up with: GNU Emacs 23.3.1
-;;; Enhancements on defmethod and lambda-lists indentation by Didier Verna.
+;;; Plus:
+;;; - Enhancements on defmethod and lambda-lists indentation by Didier Verna.
+;;; - Enhancements on LOOP indentation merged from Slime.
+;;; - A couple of additions from Nikodemus Siivola.
;;; Commentary:
@@ -73,20 +76,12 @@
:type 'boolean
:group 'lisp-indent)
-
-(defcustom lisp-loop-keyword-indentation 3
- "Indentation of loop keywords in extended loop forms."
-:type 'integer
-:group 'lisp-indent)
-
-
-(defcustom lisp-loop-forms-indentation 5
- "Indentation of forms in extended loop forms."
-:type 'integer
+(defcustom lisp-loop-indent-subclauses t
+ "Whether or not to indent loop subclauses."
+:type 'boolean
:group 'lisp-indent)
-
-(defcustom lisp-simple-loop-indentation 3
+(defcustom lisp-simple-loop-indentation 2
"Indentation of forms in simple loop forms."
:type 'integer
:group 'lisp-indent)
@@ -141,34 +136,6 @@
This applies when the value of the `common-lisp-indent-function' property
is set to `defun'.")
-
-(defun extended-loop-p (loop-start)
- "True if an extended loop form starts at LOOP-START."
- (condition-case ()
- (save-excursion
- (goto-char loop-start)
- (forward-char 1)
- (forward-sexp 2)
- (backward-sexp 1)
- (looking-at "\\sw"))
- (error t)))
-
-
-(defun common-lisp-loop-part-indentation (indent-point state)
- "Compute the indentation of loop form constituents."
- (let* ((loop-indentation (save-excursion
- (goto-char (elt state 1))
- (current-column))))
- (goto-char indent-point)
- (beginning-of-line)
- (cond ((not (extended-loop-p (elt state 1)))
- (+ loop-indentation lisp-simple-loop-indentation))
- ((looking-at "^\\s-*\\(:?\\sw+\\|;\\)")
- (+ loop-indentation lisp-loop-keyword-indentation))
- (t
- (+ loop-indentation lisp-loop-forms-indentation)))))
-
-
;;;###autoload
(defun common-lisp-indent-function (indent-point state)
"Function to indent the arguments of a Lisp function call.
@@ -240,10 +207,7 @@
* arguments after the first should be lists, and there may be any number
of them. The first list element has an offset of 2, all the rest
have an offset of 2+1=3."
- (if (save-excursion (goto-char (elt state 1))
- (looking-at "([Ll][Oo][Oo][Pp]"))
- (common-lisp-loop-part-indentation indent-point state)
- (common-lisp-indent-function-1 indent-point state)))
+ (common-lisp-indent-function-1 indent-point state))
(defun common-lisp-indent-function-1 (indent-point state)
@@ -317,8 +281,8 @@
((null method)
(when (null (cdr path))
;; (package prefix was stripped off above)
- (cond ((string-match "\\`def"
- function)
+ (cond ((and (string-match "\\`def" function)
+ (not (string-match "\\`default" function)))
(setq tentative-defun t))
((string-match
(eval-when-compile
@@ -337,11 +301,6 @@
(not (eq (char-after (- containing-sexp 2)) ?\#)))
;; No indentation for "'(...)" elements
(setq calculated (1+ sexp-column)))
- ((or (eq (char-after (1- containing-sexp)) ?\,)
- (and (eq (char-after (1- containing-sexp)) ?\@)
- (eq (char-after (- containing-sexp 2)) ?\,)))
- ;; ",(...)" or ",@(...)"
- (setq calculated normal-indent))
((eq (char-after (1- containing-sexp)) ?\#)
;; "#(...)"
(setq calculated (1+ sexp-column)))
@@ -433,8 +392,7 @@
(let (limit)
(cond ((save-excursion
(goto-char indent-point)
- (beginning-of-line)
- (skip-chars-forward " \t")
+ (back-to-indentation)
(setq limit (point))
(looking-at lisp-indent-lambda-list-keywords-regexp))
;; We're facing a lambda-list keyword.
@@ -519,10 +477,7 @@
(null (cdr method)))
(lisp-indent-report-bad-format method))
- (cond ((and tail (not (consp tem)))
- ;; indent tail of &rest in same way as first elt of rest
- (throw 'exit normal-indent))
- ((eq tem '&body)
+ (cond ((eq tem '&body)
;; &body means (&rest <lisp-body-indent>)
(throw 'exit
(if (and (= n 0) ;first body form
@@ -593,8 +548,7 @@
normal-indent
(save-excursion
(goto-char indent-point)
- (beginning-of-line)
- (skip-chars-forward " \t")
+ (back-to-indentation)
(list (cond ((looking-at "\\sw\\|\\s_")
;; a tagbody tag
(+ sexp-column lisp-tag-indentation))
@@ -668,8 +622,252 @@
(+ sexp-column lisp-body-indent)))
(error (+ sexp-column lisp-body-indent)))))
+(defun lisp-indent-loop (path state indent-point sexp-column normal-indent)
+ (if lisp-loop-indent-subclauses
+ (list (common-lisp-indent-loop-macro-1 state indent-point)
+ (common-lisp-indent-parse-state-start state))
+ (common-lisp-loop-part-indentation indent-point state)))
+
+;;;; LOOP indentation, the simple version
+
+(defun common-lisp-loop-type (loop-start)
+ "Returns the type of the loop form at LOOP-START.
+Possible types are SIMPLE, EXTENDED, and EXTENDED/SPLIT.
+EXTENDED/SPLIT refers to extended loops whose body does
+not start on the same line as the opening parenthesis of
+the loop."
+ (condition-case ()
+ (save-excursion
+ (goto-char loop-start)
+ (let ((line (line-number-at-pos)))
+ (forward-char 1)
+ (forward-sexp 2)
+ (backward-sexp 1)
+ (if (looking-at "\\sw")
+ (if (= line (line-number-at-pos))
+ 'extended
+ 'extended/split)
+ 'simple)))
+ (error 'simple)))
+
+(defun common-lisp-loop-part-indentation (indent-point state)
+ "Compute the indentation of loop form constituents."
+ (let* ((loop-start (elt state 1))
+ (type (common-lisp-loop-type loop-start))
+ (loop-indentation (save-excursion
+ (goto-char loop-start)
+ (if (eq 'extended/split type)
+ (- (current-column) 4)
+ (current-column)))))
+ (goto-char indent-point)
+ (beginning-of-line)
+ (cond ((eq 'simple type)
+ (+ loop-indentation lisp-simple-loop-indentation))
+ ((looking-at "^\\s-*\\(:?\\sw+\\|;\\)")
+ (list (+ loop-indentation 6) loop-start))
+ (t
+ (list (+ loop-indentation 9) loop-start)))))
+
+;;;; LOOP indentation, the complex version -- handles subclause indentation
+
+;; Regexps matching various varieties of loop macro keyword ...
+(defvar common-lisp-indent-body-introducing-loop-macro-keyword
+ "do\\|finally\\|initially"
+ "Regexp matching loop macro keywords which introduce body-forms.")
+
+;; This is so "and when" and "else when" get handled right
+;; (not to mention "else do" !!!)
+(defvar common-lisp-indent-prefix-loop-macro-keyword
+ "and\\|else"
+ "Regexp matching loop macro keywords which are prefixes.")
+
+(defvar common-lisp-indent-clause-joining-loop-macro-keyword
+ "and"
+ "Regexp matching 'and', and anything else there ever comes to be like it.")
+
+;; This is handled right, but it's incomplete ...
+;; (It could probably get arbitrarily long if I did *every* iteration-path)
+(defvar common-lisp-indent-indented-loop-macro-keyword
+ "into\\|by\\|upto\\|downto\\|above\\|below\\|on\\|being\\|=\\|first\\|then\\|from\\|to"
+ "Regexp matching keywords introducing loop subclauses.
+Always indented two.")
+
+(defvar common-lisp-indent-indenting-loop-macro-keyword
+ "when\\|unless\\|if"
+ "Regexp matching keywords introducing conditional clauses.
+Cause subsequent clauses to be indented.")
+
+(defvar common-lisp-indent-loop-macro-else-keyword "else")
+
+;;; Attempt to indent the loop macro ...
+
+(defun common-lisp-indent-parse-state-depth (parse-state)
+ (car parse-state))
+
+(defun common-lisp-indent-parse-state-start (parse-state)
+ (car (cdr parse-state)))
+
+(defun common-lisp-indent-parse-state-prev (parse-state)
+ (car (cdr (cdr parse-state))))
+
+(defun common-lisp-indent-loop-macro-1 (parse-state indent-point)
+ (catch 'return-indentation
+ (save-excursion
+ ;; Find first clause of loop macro, and use it to establish
+ ;; base column for indentation
+ (goto-char (common-lisp-indent-parse-state-start parse-state))
+ (let ((loop-start-column (current-column)))
+ (common-lisp-indent-loop-advance-past-keyword-on-line)
+
+ (when (eolp)
+ (forward-line 1)
+ (end-of-line)
+ ;; If indenting first line after "(loop <newline>"
+ ;; cop out ...
+ (if (<= indent-point (point))
+ (throw 'return-indentation (+ 2 loop-start-column)))
+ (back-to-indentation))
+
+ (let* ((case-fold-search t)
+ (loop-macro-first-clause (point))
+ (previous-expression-start
+ (common-lisp-indent-parse-state-prev parse-state))
+ (default-value (current-column))
+ (loop-body-p nil)
+ (loop-body-indentation nil)
+ (indented-clause-indentation (+ 2 default-value)))
+ ;; Determine context of this loop clause, starting with the
+ ;; expression immediately preceding the line we're trying to indent
+ (goto-char previous-expression-start)
+
+ ;; Handle a body-introducing-clause which ends a line specially.
+ (if (looking-at
+ common-lisp-indent-body-introducing-loop-macro-keyword)
+ (let ((keyword-position (current-column)))
+ (setq loop-body-p t)
+ (setq loop-body-indentation
+ (if (common-lisp-indent-loop-advance-past-keyword-on-line)
+ (current-column)
+ (back-to-indentation)
+ (if (/= (current-column) keyword-position)
+ (+ 2 (current-column))
+ (+ keyword-position 3)))))
+
+ (back-to-indentation)
+ (if (< (point) loop-macro-first-clause)
+ (goto-char loop-macro-first-clause))
+ ;; If there's an "and" or "else," advance over it.
+ ;; If it is alone on the line, the next "cond" will treat it
+ ;; as if there were a "when" and indent under it ...
+ (let ((exit nil))
+ (while (and (null exit)
+ (looking-at
+ common-lisp-indent-prefix-loop-macro-keyword))
+ (if (null
+ (common-lisp-indent-loop-advance-past-keyword-on-line))
+ (progn (setq exit t)
+ (back-to-indentation)))))
+
+ ;; Found start of loop clause preceding the one we're trying to
+ ;; indent. Glean context ...
+ (cond
+ ((looking-at "(")
+ ;; We're in the middle of a clause body ...
+ (setq loop-body-p t)
+ (setq loop-body-indentation (current-column)))
+ ((looking-at
+ common-lisp-indent-body-introducing-loop-macro-keyword)
+ (setq loop-body-p t)
+ ;; Know there's something else on the line (or would
+ ;; have been caught above)
+ (common-lisp-indent-loop-advance-past-keyword-on-line)
+ (setq loop-body-indentation (current-column)))
+ (t
+ (setq loop-body-p nil)
+ (if (or (looking-at
+ common-lisp-indent-indenting-loop-macro-keyword)
+ (looking-at
+ common-lisp-indent-prefix-loop-macro-keyword))
+ (setq default-value (+ 2 (current-column))))
+ (setq indented-clause-indentation (+ 2 (current-column)))
+ ;; We still need loop-body-indentation for "syntax errors" ...
+ (goto-char previous-expression-start)
+ (setq loop-body-indentation (current-column)))))
+
+ ;; Go to first non-blank character of the line we're trying to
+ ;; indent. (if none, wind up poised on the new-line ...)
+ (goto-char indent-point)
+ (back-to-indentation)
+ (cond
+ ((looking-at "(")
+ ;; Clause body ...
+ loop-body-indentation)
+ ((or (eolp) (looking-at ";"))
+ ;; Blank line. If body-p, indent as body, else indent as
+ ;; vanilla clause.
+ (if loop-body-p
+ loop-body-indentation
+ default-value))
+ ((looking-at common-lisp-indent-indented-loop-macro-keyword)
+ indented-clause-indentation)
+ ((looking-at common-lisp-indent-clause-joining-loop-macro-keyword)
+ (let ((stolen-indent-column nil))
+ (forward-line -1)
+ (while (and (null stolen-indent-column)
+ (> (point) loop-macro-first-clause))
+ (back-to-indentation)
+ (if (and (< (current-column) loop-body-indentation)
+ (looking-at "\\sw"))
+ (progn
+ (if (looking-at
+ common-lisp-indent-loop-macro-else-keyword)
+ (common-lisp-indent-loop-advance-past-keyword-on-line))
+ (setq stolen-indent-column
+ (current-column)))
+ (forward-line -1)))
+ (if stolen-indent-column
+ stolen-indent-column
+ default-value)))
+ (t default-value)))))))
+
+(defun common-lisp-indent-loop-advance-past-keyword-on-line ()
+ (forward-word 1)
+ (while (and (looking-at "\\s-") (not (eolp)))
+ (forward-char 1))
+ (if (eolp)
+ nil
+ (current-column)))
+
+;; Test-case for subclause indentation
+'(loop for i from 0 below 2
+ for j from 0 below 2
+ when foo
+ do (fubar)
+ (bar)
+ (moo)
+ and collect cash
+ into honduras
+ else do ;; this is the body of the first else
+ ;; the body is ...
+ (indented to the above comment)
+ (ZMACS gets this wrong)
+ and do this
+ and do that
+ and when foo
+ do the-other
+ and cry
+ when this-is-a-short-condition do
+ (body code of the when)
+ when here's something I used to botch do (here is a body)
+ (rest of body indented same)
+ do
+ (exdented loop body)
+ (I'm not sure I like this but it's compatible)
+ when funny-predicate do ;; Here's a comment
+ (body filled to comment))
+;;;; Indentation specs for standard symbols, and a few semistandard ones.
(let ((l '((block 1)
(case (4 &rest (&whole 2 &rest 1)))
(ccase . case)
@@ -724,7 +922,7 @@
(handler-bind . let)
(restart-bind . let)
(locally 1)
- ;(loop lisp-indent-loop)
+ (loop lisp-indent-loop)
(:method (&lambda &body)) ; in `defgeneric'
(multiple-value-bind ((&whole 6 &rest 1) 4 &body))
(multiple-value-call (4 &body))
--
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Correct ruby detection, func-menu.el
13 years, 7 months
Aidan Kehoe
Hans just brought my attention to this in IRC, thanks Hans.
APPROVE COMMIT
NOTE: This patch has been committed.
xemacs-packages/edit-utils/ChangeLog addition:
2011-05-11 Aidan Kehoe <kehoea(a)parhasard.net>
* func-menu.el (fume-function-name-regexp-ruby):
* func-menu.el (fume-find-next-ruby-function-name):
Handle the module concept for Ruby correctly in this file, as
suggested by Hans de Graaff in tracker issue 355.
XEmacs Packages source patch:
Diff command: cvs -q diff -Nu
Files affected: xemacs-packages/edit-utils/func-menu.el
Index: xemacs-packages/edit-utils/func-menu.el
===================================================================
RCS file: /cvsroot/xemacs/XEmacs/packages/xemacs-packages/edit-utils/func-menu.el,v
retrieving revision 1.28
diff -u -u -r1.28 func-menu.el
--- xemacs-packages/edit-utils/func-menu.el 22 Dec 2004 21:42:03 -0000 1.28
+++ xemacs-packages/edit-utils/func-menu.el 11 May 2011 11:45:45 -0000
@@ -817,7 +817,7 @@
;; Albert Davidson Chou <Al_Chou(a)CyberDude.com>
;; Claus Brunzema <mail(a)cbrunzema.de>
(defvar fume-function-name-regexp-ruby
- "^\\s-*\\(class\\|def\\)+\\s-*\\([^(\n ]+\\)")
+ "^\\s-*\\(class\\|module\\|def\\)+\\s-*\\([^(\n ]+\\)")
;; Python support
;; Shuichi Koga <skoga(a)virginia.edu>
@@ -1394,9 +1394,9 @@
(goto-char (match-beginning 0))
(cond ((looking-at "^\\s-*def")
(re-search-backward
- "\n?\\s-*class\\s-*\\([A-Z][A-Za-z0-9_]*\\)\\s-*" nil t)
+ "\n?\\s-*\\(class\\|module\\)\\s-*\\([A-Z][A-Za-z0-9_]*\\)\\s-*" nil nil)
(let* ((classname (buffer-substring
- (match-beginning 1) (match-end 1))))
+ (match-beginning 2) (match-end 2))))
(if (not (string-match (concat "^" classname "\\.") retname))
(setq retname (concat classname "." retname))))))
(cons retname retpnt)))))
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: Complete support for macro-declaration-function, bytecomp{, -runtime}.el
13 years, 7 months
Aidan Kehoe
changeset: 5565:b0d87f92e60b
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sun May 08 09:19:25 2011 +0100
files: lisp/ChangeLog lisp/bytecomp-runtime.el lisp/bytecomp.el lisp/subr.el src/ChangeLog src/eval.c src/lisp.h
description:
Complete support for macro-declaration-function, bytecomp{,-runtime}.el
lisp/ChangeLog addition:
2011-05-07 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp-runtime.el:
* bytecomp.el (byte-compile-file-form-defmumble):
* bytecomp-runtime.el (macro-declaration-function): New.
* subr.el:
* subr.el (macro-declaration-function): Removed.
Add support for macro-declaration-function, which is a GNU
mechanism for indicating indentation and edebug information in
macros (and only in macros).
src/ChangeLog addition:
2011-05-07 Aidan Kehoe <kehoea(a)parhasard.net>
* eval.c:
* eval.c (Fdefmacro):
* eval.c (syms_of_eval):
Support macro-declaration-function in defmacro, incompletely and
without documentation.
* lisp.h:
Declare Fnth here, necessary for the previous changes.
diff -r 3b220aa03f89 -r b0d87f92e60b lisp/ChangeLog
--- a/lisp/ChangeLog Sat May 07 21:27:27 2011 +0100
+++ b/lisp/ChangeLog Sun May 08 09:19:25 2011 +0100
@@ -1,3 +1,14 @@
+2011-05-07 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecomp-runtime.el:
+ * bytecomp.el (byte-compile-file-form-defmumble):
+ * bytecomp-runtime.el (macro-declaration-function): New.
+ * subr.el:
+ * subr.el (macro-declaration-function): Removed.
+ Add support for macro-declaration-function, which is a GNU
+ mechanism for indicating indentation and edebug information in
+ macros (and only in macros).
+
2011-05-07 Aidan Kehoe <kehoea(a)parhasard.net>
* subr.el:
diff -r 3b220aa03f89 -r b0d87f92e60b lisp/bytecomp-runtime.el
--- a/lisp/bytecomp-runtime.el Sat May 07 21:27:27 2011 +0100
+++ b/lisp/bytecomp-runtime.el Sun May 08 09:19:25 2011 +0100
@@ -38,6 +38,43 @@
;;; Code:
+;; We define macro-declaration-function here because it is needed to
+;; handle declarations in macro definitions and this is the first file
+;; loaded by loadup.el that uses declarations in macros.
+(defun macro-declaration-function (macro decl)
+ "Process a declaration found in a macro definition.
+This is set as the value of the variable `macro-declaration-function'.
+MACRO is the name of the macro being defined.
+DECL is a list `(declare ...)' containing the declarations.
+The return value of this function is not used.
+
+XEmacs; any forms handed to the function described by the variable
+`macro-declaration-function' will also (eventually) be handled by the
+`declare' macro; see its documentation for further details of this."
+ ;; We can't use `dolist' or `cadr' yet for bootstrapping reasons.
+ (let (d)
+ ;; Ignore the first element of `decl' (it's always `declare').
+ (while (setq decl (cdr decl))
+ (setq d (car decl))
+ (if (and (consp d)
+ (listp (cdr d))
+ (null (cdr (cdr d))))
+ (cond ((eq (car d) 'indent)
+ (put macro 'lisp-indent-function (car (cdr d))))
+ ((eq (car d) 'debug)
+ (put macro 'edebug-form-spec (car (cdr d))))
+ ((eq (car d) 'doc-string)
+ ;;; #### XEmacs; not sure that this does anything sensible.
+ (put macro 'doc-string-elt (car (cdr d))))
+ ;; XEmacs; don't warn about the known XEmacs declarations.
+ ((memq (car d) '(special inline notinline optimize warn)))
+ (t
+ (message "Unknown declaration %s" d)))
+ (message "Invalid declaration %s" d)))))
+
+(setq macro-declaration-function 'macro-declaration-function)
+
+
;; Redefined in byte-optimize.el.
;; This is not documented--it's not clear that we should promote it.
(fset 'inline 'progn)
diff -r 3b220aa03f89 -r b0d87f92e60b lisp/bytecomp.el
--- a/lisp/bytecomp.el Sat May 07 21:27:27 2011 +0100
+++ b/lisp/bytecomp.el Sun May 08 09:19:25 2011 +0100
@@ -2297,6 +2297,26 @@
(stringp (car-safe (cdr-safe (cdr-safe body)))))
(byte-compile-warn "Probable `\"' without `\\' in doc string of %s"
(nth 1 form))))
+
+ ;; Generate code for declarations in macro definitions.
+ ;; Remove declarations from the body of the macro definition.
+ (when macrop
+ (let ((byte-compile-defmacro-body (nthcdr 3 form)))
+ (if (stringp (car byte-compile-defmacro-body))
+ (setq byte-compile-defmacro-body (nthcdr 4 form)))
+ (when (and (consp byte-compile-defmacro-body)
+ (eq 'declare (car-safe (car byte-compile-defmacro-body))))
+ (if (eq 'declare (car-safe (car-safe
+ (cdr byte-compile-defmacro-body))))
+ (byte-compile-warn "Multiple macro-specific `declare' calls \
+not supported by XEmacs."))
+ (setq byte-compile-output-preface
+ (byte-compile-top-level
+ `(progn (and macro-declaration-function
+ (funcall macro-declaration-function
+ ',name
+ ',(car byte-compile-defmacro-body)))
+ ,byte-compile-output-preface) t 'file)))))
(let* ((new-one (byte-compile-lambda (cons 'lambda (nthcdr 2 form))))
(code (byte-compile-byte-code-maker new-one))
(docform-info
diff -r 3b220aa03f89 -r b0d87f92e60b lisp/subr.el
--- a/lisp/subr.el Sat May 07 21:27:27 2011 +0100
+++ b/lisp/subr.el Sun May 08 09:19:25 2011 +0100
@@ -39,22 +39,6 @@
;; XEmacs; no need for custom-declare-variable-list, preloaded-file-list is
;; ordered to make it unnecessary.
-
-(defun macro-declaration-function (macro decl)
- "Process a declaration found in a macro definition.
-This is set as the value of the variable `macro-declaration-function'.
-MACRO is the name of the macro being defined.
-DECL is a list `(declare ...)' containing the declarations.
-The return value of this function is not used."
- (dolist (d (cdr decl))
- (cond ((and (consp d) (eq (car d) 'indent))
- (put macro 'lisp-indent-function (cadr d)))
- ((and (consp d) (eq (car d) 'debug))
- (put macro 'edebug-form-spec (cadr d)))
- (t
- (message "Unknown declaration %s" d)))))
-
-(setq macro-declaration-function 'macro-declaration-function)
;; XEmacs; this is here because we use it in backquote.el, so it needs to be
;; available the first time a `(...) form is expanded.
diff -r 3b220aa03f89 -r b0d87f92e60b src/ChangeLog
--- a/src/ChangeLog Sat May 07 21:27:27 2011 +0100
+++ b/src/ChangeLog Sun May 08 09:19:25 2011 +0100
@@ -1,3 +1,13 @@
+2011-05-07 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * eval.c:
+ * eval.c (Fdefmacro):
+ * eval.c (syms_of_eval):
+ Support macro-declaration-function in defmacro, incompletely and
+ without documentation.
+ * lisp.h:
+ Declare Fnth here, necessary for the previous changes.
+
2011-05-07 Aidan Kehoe <kehoea(a)parhasard.net>
* s/netbsd.h:
diff -r 3b220aa03f89 -r b0d87f92e60b src/eval.c
--- a/src/eval.c Sat May 07 21:27:27 2011 +0100
+++ b/src/eval.c Sun May 08 09:19:25 2011 +0100
@@ -224,7 +224,7 @@
every attempt to throw past this level. */
Lisp_Object Vcatch_everything_tag;
-Lisp_Object Qautoload, Qmacro, Qexit;
+Lisp_Object Qautoload, Qmacro, Qexit, Qdeclare;
Lisp_Object Qinteractive, Qcommandp, Qdefun, Qprogn, Qvalues;
Lisp_Object Vquit_flag, Vinhibit_quit;
Lisp_Object Qand_rest, Qand_optional;
@@ -273,6 +273,8 @@
(FUN . ODEF) for a defun, (OFEATURES . nil) for a provide. */
Lisp_Object Vautoload_queue;
+Lisp_Object Vmacro_declaration_function;
+
/* Current number of specbindings allocated in specpdl. */
int specpdl_size;
@@ -1406,6 +1408,33 @@
(args))
{
/* This function can GC */
+ if (!NILP (Vmacro_declaration_function))
+ {
+ Lisp_Object declare = Fnth (make_int (2), args);
+
+ /* Sigh. This GNU interface is incompatible with the CL declare macro,
+ and the latter is much older.
+
+ GNU describe this syntax in their docstrings. It's sufficiently
+ ugly in the XEmacs context (and in general, but ...) that I'm not
+ rushing to document it.
+
+ The GNU interface accepts multiple (declare ...) sexps at the
+ beginning of a macro. Nothing uses this, and the XEmacs byte
+ compiler (will) warn(s) if it encounters code that attempts to use
+ it. */
+
+ if (STRINGP (declare))
+ {
+ declare = Fnth (make_int (3), args);
+ }
+
+ if (CONSP (declare) && EQ (Qdeclare, XCAR (declare)))
+ {
+ call2 (Vmacro_declaration_function, XCAR (args), declare);
+ }
+ }
+
return define_function (XCAR (args),
Fcons (Qmacro, Fcons (Qlambda, XCDR (args))));
}
@@ -7315,6 +7344,7 @@
defsymbol (&Qand_optional, "&optional");
/* Note that the process code also uses Qexit */
DEFSYMBOL (Qexit);
+ DEFSYMBOL (Qdeclare);
DEFSYMBOL (Qsetq);
DEFSYMBOL (Qinteractive);
DEFSYMBOL (Qcommandp);
@@ -7572,6 +7602,15 @@
*/);
Vmultiple_values_limit = EMACS_INT_MAX > INT_MAX ? INT_MAX : EMACS_INT_MAX;
+ DEFVAR_LISP ("macro-declaration-function", &Vmacro_declaration_function /*
+Function to process declarations in a macro definition.
+The function will be called with two args MACRO and DECL.
+MACRO is the name of the macro being defined.
+DECL is a list `(declare ...)' containing the declarations.
+The value the function returns is not used.
+*/);
+ Vmacro_declaration_function = Qnil;
+
staticpro (&Vcatch_everything_tag);
Vcatch_everything_tag = make_opaque (OPAQUE_CLEAR, 0);
diff -r 3b220aa03f89 -r b0d87f92e60b src/lisp.h
--- a/src/lisp.h Sat May 07 21:27:27 2011 +0100
+++ b/src/lisp.h Sun May 08 09:19:25 2011 +0100
@@ -5247,6 +5247,7 @@
EXFUN (Fnconc, MANY);
MODULE_API EXFUN (Fnreverse, 1);
EXFUN (Fnthcdr, 2);
+EXFUN (Fnth, 2);
EXFUN (Fold_assq, 2);
EXFUN (Fold_equal, 2);
EXFUN (Fold_member, 2);
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: Remove an extraneous #endif, s/netbsd.h, thank you Adam Sjoegren!
13 years, 7 months
Aidan Kehoe
changeset: 5564:3b220aa03f89
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sat May 07 21:27:27 2011 +0100
files: src/ChangeLog src/s/netbsd.h
description:
Remove an extraneous #endif, s/netbsd.h, thank you Adam Sjoegren!
src/ChangeLog addition:
2011-05-07 Aidan Kehoe <kehoea(a)parhasard.net>
* s/netbsd.h:
Remove an extraneous #endif, hopefully fixing the NetBSD and
OpenBSD builds; thank you Adam Sjoegren!
diff -r d3e0482c7899 -r 3b220aa03f89 src/ChangeLog
--- a/src/ChangeLog Sat May 07 16:57:17 2011 +0100
+++ b/src/ChangeLog Sat May 07 21:27:27 2011 +0100
@@ -1,3 +1,9 @@
+2011-05-07 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * s/netbsd.h:
+ Remove an extraneous #endif, hopefully fixing the NetBSD and
+ OpenBSD builds; thank you Adam Sjøgren!
+
2011-05-07 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (Fsplit_path): Removed.
diff -r d3e0482c7899 -r 3b220aa03f89 src/s/netbsd.h
--- a/src/s/netbsd.h Sat May 07 16:57:17 2011 +0100
+++ b/src/s/netbsd.h Sat May 07 21:27:27 2011 +0100
@@ -121,7 +121,6 @@
/* arch-tag: e80f364a-04e9-4faf-93cb-f36a0fe95c81
(do not change this comment) */
-#endif /* 0 */
/* Begin XEmacs additions */
#undef BSD
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches