[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master b4d4672 14/40: align: Support vfuncs
From: |
Daiki Ueno |
Subject: |
[elpa] master b4d4672 14/40: align: Support vfuncs |
Date: |
Fri, 22 Jan 2016 22:48:39 +0000 |
branch: master
commit b4d4672477cf591293a723ec544cb940cbc34c05
Author: Daiki Ueno <address@hidden>
Commit: Daiki Ueno <address@hidden>
align: Support vfuncs
---
gobject-align.el | 14 +++++++++++---
gobject-tests.el | 24 +++++++++++++++++++++++-
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/gobject-align.el b/gobject-align.el
index 3042fed..8db4f9d 100644
--- a/gobject-align.el
+++ b/gobject-align.el
@@ -269,20 +269,28 @@
(let (arglist-start
arglist-end
identifier-start
- identifier-end)
+ identifier-end
+ vfunc-p)
(goto-char (point-min))
(c-forward-syntactic-ws)
(unless (looking-at
-
"typedef\\|#\\|G_DECLARE_\\(?:\\(?:FINAL\\|DECLARATIVE\\)_TYPE\\|INTERFACE\\)")
+ "typedef\\|#\\|G_\\(?:DECLARE\\|DEFINE\\)")
(while (and (not (eobp))
(not (eq (char-after) ?\()))
(c-forward-token-2)
(c-forward-syntactic-ws))
+ ;; Identifier is vfunc.
+ (when (looking-at "(\\s-*\\*")
+ (c-forward-sexp)
+ (c-forward-syntactic-ws)
+ (setq vfunc-p t))
(when (eq (char-after) ?\()
(setq arglist-start (point-marker))
(c-backward-syntactic-ws)
(setq identifier-end (point-marker))
- (c-backward-token-2)
+ (if vfunc-p
+ (c-backward-sexp)
+ (c-backward-token-2))
(setq identifier-start (point-marker))
(goto-char arglist-start)
(c-forward-sexp)
diff --git a/gobject-tests.el b/gobject-tests.el
index c06c0a5..e0ec750 100644
--- a/gobject-tests.el
+++ b/gobject-tests.el
@@ -45,6 +45,18 @@ GDK_AVAILABLE_IN_3_16
const gchar ** gtk_widget_list_action_prefixes (GtkWidget
*widget);
")
+(defconst gobject-test-program-3 "\
+ /* overridable methods */
+ void (*set_property) (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+ void (*get_property) (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+")
+
(ert-deftest gobject-test-align--compute-optimal-columns ()
"Tests the `gobject-align--compute-optimal-columns'."
(with-temp-buffer
@@ -64,7 +76,7 @@ const gchar ** gtk_widget_list_action_prefixes
(GtkWidget *
(gobject-align-region (point-min) (point-max))
(should (equal (buffer-string) gobject-test-program-1-aligned))))
-(ert-deftest gobject-test-align-guess-columns ()
+(ert-deftest gobject-test-align-guess-columns-1 ()
"Tests the `gobject-align-guess-columns'."
(with-temp-buffer
(insert gobject-test-program-2)
@@ -73,3 +85,13 @@ const gchar ** gtk_widget_list_action_prefixes
(GtkWidget *
(should (= gobject-align-identifier-start-column 24))
(should (= gobject-align-arglist-start-column 56))
(should (= gobject-align-arglist-identifier-start-column 80))))
+
+(ert-deftest gobject-test-align-guess-columns-2 ()
+ "Tests the `gobject-align-guess-columns'."
+ (with-temp-buffer
+ (insert gobject-test-program-3)
+ (c-mode)
+ (gobject-align-guess-columns (point-min) (point-max))
+ (should (= gobject-align-identifier-start-column 13))
+ (should (= gobject-align-arglist-start-column 40))
+ (should (= gobject-align-arglist-identifier-start-column 57))))
- [elpa] master a0fbb58 06/40: align: Fix off-by-one in positioning argument, (continued)
- [elpa] master a0fbb58 06/40: align: Fix off-by-one in positioning argument, Daiki Ueno, 2016/01/22
- [elpa] master 0d84312 08/40: Fix wording in README.md, Daiki Ueno, 2016/01/22
- [elpa] master 6a12630 07/40: Add examples to README.md, Daiki Ueno, 2016/01/22
- [elpa] master 8579586 10/40: align: Minor refactoring, Daiki Ueno, 2016/01/22
- [elpa] master ea42394 09/40: Fix wording in README.md, Daiki Ueno, 2016/01/22
- [elpa] master dcb6a2e 03/40: align: Support guessing/setting alignment rules, Daiki Ueno, 2016/01/22
- [elpa] master 2f5707d 11/40: align: Fix previous commit, Daiki Ueno, 2016/01/22
- [elpa] master 870e78c 12/40: Add ERT tests, Daiki Ueno, 2016/01/22
- [elpa] master 7285abe 15/40: Reorder commands in README.md, Daiki Ueno, 2016/01/22
- [elpa] master 1ad58dc 01/40: Initial import, Daiki Ueno, 2016/01/22
- [elpa] master b4d4672 14/40: align: Support vfuncs,
Daiki Ueno <=
- [elpa] master ae40679 18/40: Add symlink to README, Daiki Ueno, 2016/01/22
- [elpa] master 1e67806 19/40: snippet: Make options customizable, Daiki Ueno, 2016/01/22
- [elpa] master e8714b1 13/40: align: -guess-columns -> -compute-optimal-columns, Daiki Ueno, 2016/01/22
- [elpa] master abb9dd4 21/40: Revert "align: Add a room before '*' for arguments", Daiki Ueno, 2016/01/22
- [elpa] master d608680 20/40: align: Add a room before '*' for arguments, Daiki Ueno, 2016/01/22
- [elpa] master 147931d 27/40: Fix typo, Daiki Ueno, 2016/01/22
- [elpa] master ec40108 23/40: align: Use `max' as much as possible, Daiki Ueno, 2016/01/22
- [elpa] master d6d27bd 22/40: align: Reimplement d6086809, Daiki Ueno, 2016/01/22
- [elpa] master ccb6062 24/40: tests: Bind `gnome-align-max-column', Daiki Ueno, 2016/01/22
- [elpa] master f339477 28/40: Add references to developer.gnome.org, Daiki Ueno, 2016/01/22