[elpa] master b886f36: Version: bump to 0.8 in debbugs files

2015-11-24 Thread Michael Albinus
branch: master
commit b886f36c5d793b1e9833dfb36f6bd6443a429a6a
Author: Michael Albinus 
Commit: Michael Albinus 

Version: bump to 0.8 in debbugs files
---
 packages/debbugs/debbugs-browse.el |2 +-
 packages/debbugs/debbugs-org.el|2 +-
 packages/debbugs/debbugs.el|2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/packages/debbugs/debbugs-browse.el 
b/packages/debbugs/debbugs-browse.el
index 39b6357..0201c3b 100644
--- a/packages/debbugs/debbugs-browse.el
+++ b/packages/debbugs/debbugs-browse.el
@@ -5,7 +5,7 @@
 ;; Author: Michael Albinus 
 ;; Keywords: comm, hypermedia, maint
 ;; Package: debbugs
-;; Version: 0.7
+;; Version: 0.8
 
 ;; This file is part of GNU Emacs.
 
diff --git a/packages/debbugs/debbugs-org.el b/packages/debbugs/debbugs-org.el
index a1b283a..f56c539 100644
--- a/packages/debbugs/debbugs-org.el
+++ b/packages/debbugs/debbugs-org.el
@@ -5,7 +5,7 @@
 ;; Author: Michael Albinus 
 ;; Keywords: comm, hypermedia, maint, outlines
 ;; Package: debbugs
-;; Version: 0.7
+;; Version: 0.8
 
 ;; This file is not part of GNU Emacs.
 
diff --git a/packages/debbugs/debbugs.el b/packages/debbugs/debbugs.el
index c469193..4bfbb90 100644
--- a/packages/debbugs/debbugs.el
+++ b/packages/debbugs/debbugs.el
@@ -5,7 +5,7 @@
 ;; Author: Michael Albinus 
 ;; Keywords: comm, hypermedia
 ;; Package: debbugs
-;; Version: 0.7
+;; Version: 0.8
 
 ;; This file is not part of GNU Emacs.
 



[elpa] master 5d79ce4: * sm-c-mode: Improve indentation of struct; plus bug fixes

2015-11-24 Thread Stefan Monnier
branch: master
commit 5d79ce42f323cd10aed073aac50104a2d7920ec3
Author: Stefan Monnier 
Commit: Stefan Monnier 

* sm-c-mode: Improve indentation of struct; plus bug fixes

* packages/sm-c-mode/GNUmakefile: New file.

* packages/sm-c-mode/sm-c-mode-test.c: Add some "struct" tests.
Plus a #include.

* packages/sm-c-mode/sm-c-mode.el (sm-c-syntax-propertize): Mark the <...>
of #include as a string.
(sm-c-smie--*-token): Try not to look too far back.
(sm-c-smie-rules): Indent the {...} of struct and enum definitions.
(sm-c--bs-realign-1): Fix behavior at EOB.
(sm-c--cpp-is-not-really-a-comment): New function.
(comment-only-p): Use it.
---
 packages/sm-c-mode/GNUmakefile  |   21 +++
 packages/sm-c-mode/sm-c-mode-test.c |   16 -
 packages/sm-c-mode/sm-c-mode.el |   63 --
 3 files changed, 88 insertions(+), 12 deletions(-)

diff --git a/packages/sm-c-mode/GNUmakefile b/packages/sm-c-mode/GNUmakefile
new file mode 100644
index 000..2c6da32
--- /dev/null
+++ b/packages/sm-c-mode/GNUmakefile
@@ -0,0 +1,21 @@
+
+EMACS=emacs
+DIFF=diff
+
+test: sm-c-mode-test.c.test
+
+.PHONY: refresh
+refresh:
+
+%.elc : %.el
+   $(EMACS) --batch -L . --no-init-file -f batch-byte-compile $<
+
+%.test: % sm-c-mode.elc refresh
+   $(EMACS) --batch -l sm-c-mode-autoloads.el   \
+   sm-c-mode-test.c \
+   --eval '(setq indent-tabs-mode nil)' \
+   --eval '(setq create-lockfiles nil)' \
+   --eval '(indent-region (point-min) (point-max) nil)' \
+   --eval '(indent-region (point-min) (point-max) nil)' \
+   --eval '(write-region (point-min) (point-max) "$@")'
+   $(DIFF) $< $@ || true; $(RM) $@
diff --git a/packages/sm-c-mode/sm-c-mode-test.c 
b/packages/sm-c-mode/sm-c-mode-test.c
index 94cf476..4690105 100644
--- a/packages/sm-c-mode/sm-c-mode-test.c
+++ b/packages/sm-c-mode/sm-c-mode-test.c
@@ -1,5 +1,7 @@
 /* -*- sm-c -*- */
 
+#include 
+
 #define toto(arg) /* bla
  bla */ \
   if (a) {  /* toto
@@ -11,7 +13,19 @@
 #define test(arg) \
   (hello + arg)
 
-struct foo;
+struct foo
+  {
+int field;
+  };
+
+struct foo {
+  int field;
+};
+
+struct foo *getfoo (void)
+{
+  return NULL;
+}
 
 #define titi(arg) { \
 if (a) {\
diff --git a/packages/sm-c-mode/sm-c-mode.el b/packages/sm-c-mode/sm-c-mode.el
index 7616616..1ac263e 100644
--- a/packages/sm-c-mode/sm-c-mode.el
+++ b/packages/sm-c-mode/sm-c-mode.el
@@ -35,9 +35,8 @@
 ;; it'd be nice to hook the sm-c--while-to-do, sm-c--else-to-if, and sm-c--boi
 ;; functions into SMIE at some level.
 
-;; FIXME:
-;; - M-; mistakes # for a comment in CPP directives!
-;; Ha!  As if this was the only/main problem!
+;; Note that this mode makes no attempt to try and handle sanely K style
+;; function definitions.
 
 ;;; Code:
 
@@ -233,7 +232,15 @@ Typically 2 for GNU style and `tab-width' for Linux style."
   (sm-c--cpp-syntax-propertize end)
   (funcall
(syntax-propertize-rules
-(sm-c--cpp-regexp (2 (prog1 "< c" (sm-c--cpp-syntax-propertize end)
+(sm-c--cpp-regexp
+ (2 (prog1 "< c"
+  (when (and (equal (match-string 3) "include")
+ (looking-at "[ \t]*\\(<\\)[^>\n]*\\(>\\)"))
+(put-text-property (match-beginning 1) (match-end 1)
+   'syntax-table (string-to-syntax "|"))
+(put-text-property (match-beginning 2) (match-end 2)
+   'syntax-table (string-to-syntax "|")))
+  (sm-c--cpp-syntax-propertize end)
(point) end))
 
 (defun sm-c-syntactic-face-function (ppss)
@@ -495,9 +502,19 @@ if INNER is non-nil, it stops at the innermost one."
 ((or "(" "[" "{" "}") "* deref")
 (`nil
  (goto-char pos)
- (pcase (smie-backward-sexp "* mult")
-   (`(,_ ,_ ,(or ";" "{")) "* deref")
-   (_ "* mult")))
+ (let ((res nil))
+   (while (not res)
+ (pcase (smie-backward-sexp)
+   (`(,_ ,_ ,(or ";" "{")) (setq res "* deref"))
+   ((and `nil (guard (looking-at "{"))) (setq res "* deref"))
+   (`(,left ,_ ,op)
+(if (and (numberp left)
+ (numberp (nth 2 (assoc op smie-grammar)))
+ (< (nth 2 (assoc op smie-grammar))
+(nth 1 (assoc "* mult" smie-grammar
+(smie-backward-sexp 'halfsexp)
+  (setq res "* mult")
+   res))
 (_ "* mult")
 
 (defun sm-c-smie-hanging-eolp ()
@@ -565,8 +582,20 @@ if INNER is non-nil, it stops at the innermost one."
(sm-c--boi 'inner) (sm-c--skip-labels (point-max))
(let ((tok (save-excursion (sm-c-smie-forward-token
  (cond
- 

[elpa] master d16cc52: * sm-c-mode.el: Auto-align backslashes. Improve indent rules

2015-11-24 Thread Stefan Monnier
branch: master
commit d16cc527fbdab0e42642db827f12984be916dba2
Author: Stefan Monnier 
Commit: Stefan Monnier 

* sm-c-mode.el: Auto-align backslashes.  Improve indent rules

* sm-c-mode/sm-c-mode.el: Auto-align backslashes.  Improve indent rules.
(sm-c--cpp-indent-comment-inside): New function.
(sm-c--cpp-smie-indent-functions): Use it.
(sm-c--cpp-smie-indent): Handle indentation within comments-within-cpp.
(sm-c-smie-grammar): Manually tweak precedence of ":label".
(sm-c-smie-operator-regexp): Parentheses aren't operators.
(sm-c--boi): Add `inner' arg.
(sm-c--boe): Complete the code.
(sm-c-smie--*-token): Refine.
(sm-c-smie-rules): Various tweaks based on tests on src/eval.c and
src/xdisp.c.
(sm-c--bs-changed): New var.
(sm-c--bs-after-change, sm-c--bs-realign, sm-c--bs-realign-1):
New functions.
(sm-c-mode): Use them.

* sm-c-mode/sm-c-mode-test.c: Add a few more cases.
---
 packages/sm-c-mode/sm-c-mode-test.c |   47 +-
 packages/sm-c-mode/sm-c-mode.el |  307 +--
 2 files changed, 259 insertions(+), 95 deletions(-)

diff --git a/packages/sm-c-mode/sm-c-mode-test.c 
b/packages/sm-c-mode/sm-c-mode-test.c
index 3a1f1b6..94cf476 100644
--- a/packages/sm-c-mode/sm-c-mode-test.c
+++ b/packages/sm-c-mode/sm-c-mode-test.c
@@ -1,12 +1,29 @@
 /* -*- sm-c -*- */
 
-#define toto /* bla
-bla */ \
- if (a) { \
-   f \
- }
+#define toto(arg) /* bla
+ bla */ \
+  if (a) {  /* toto
+ * titi
+ */\
+fs((arg) + 2); \
+  }
+
+#define test(arg) \
+  (hello + arg)
+
+struct foo;
+
+#define titi(arg) { \
+if (a) {\
+  f(arg + 1)\
+}   \
+  }
 
 DEFUN ()
+  ()
+{
+  return Qnil;
+}
 
 int main (void)
 {
@@ -24,10 +41,22 @@ int main (void)
 printf ("wow\n");
   else
 if (c)
-  printf ("weee\n");
+  printf
+("weee\n");
 else
   printf ("wop\n");
-
+
+  if (a)
+if (b) {
+  c;
+}
+
+  *a = b;
+
+  if (pITORIG != pITCOPY)
+*(pITORIG)
+  = *(pITCOPY);
+
   switch (a)
 {
 case 1:
@@ -42,8 +71,8 @@ int main (void)
 }
 }
 
-static struct myownspecialstruct
-  *testfunction
+static struct myownspecialstruct *
+testfunction
   (args)
 {
   return NULL;
diff --git a/packages/sm-c-mode/sm-c-mode.el b/packages/sm-c-mode/sm-c-mode.el
index 3771169..7616616 100644
--- a/packages/sm-c-mode/sm-c-mode.el
+++ b/packages/sm-c-mode/sm-c-mode.el
@@ -163,8 +163,19 @@ Typically 2 for GNU style and `tab-width' for Linux style."
 
 (defconst sm-c--cpp-smie-indent-functions
   ;; FIXME: Don't just align line after #define with the "d"!
-  (remq #'smie-indent-comment-inside
-(default-value 'smie-indent-functions)))
+  (mapcar
+   (lambda (f)
+ (cond
+  ((eq f #'smie-indent-comment-inside) #'sm-c--cpp-indent-comment-inside)
+  ;; ((eq f #'smie-indent-exps) #'sm-c--cpp-indent-exps)
+  (t f)))
+   (default-value 'smie-indent-functions)))
+
+(defun sm-c--cpp-indent-comment-inside ()
+  (let ((ppss (syntax-ppss)))
+(when (nth 4 ppss)
+  ;; Indicate where's the comment start.
+  `(noindent . ,(nth 8 ppss)
 
 (defun sm-c--cpp-smie-indent ()
   (let ((ppss (syntax-ppss)))
@@ -172,15 +183,36 @@ Typically 2 for GNU style and `tab-width' for Linux 
style."
  ((sm-c--cpp-inside-p ppss)
   (save-restriction
 (narrow-to-region (nth 8 ppss) (point-max))
-(let ((smie-indent-functions sm-c--cpp-smie-indent-functions))
-  (smie-indent-calculate
+(let ((indent
+   (let ((smie-indent-functions sm-c--cpp-smie-indent-functions)
+ (syntax-ppss-cache nil)
+ (syntax-ppss-last nil)
+ (parse-sexp-lookup-properties nil))
+ (smie-indent-calculate
+  (if (not (eq 'noindent (car-safe indent)))
+  (if (integerp indent)
+  (max (funcall smie-rules-function :elem 'basic) indent)
+indent)
+;; We can't just return `noindent' if we're inside a comment,
+;; because the indent.el code would then be similarly confused,
+;; thinking the `noindent' is because we're inside the cpp
+;; pseudo-comment, and would hence align the code with the content
+;; of the psuedo-comment rather than the nested real comment!
+;;
+;; FIXME: Copy from indent--default-inside-comment.
+;; FIXME: This will always re-indent inside these comments, even
+;; during indent-region.
+(save-excursion
+  (forward-line -1)
+  (skip-chars-forward " \t")
+  (when (< (1- (point)) (cdr indent) (line-end-position))
+(goto-char (cdr indent))
+(when (looking-at comment-start-skip)
+