From abb9dd450560828b8aa0815f4da9e42b3abe8312 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Mon, 18 Jan 2016 17:37:57 +0900 Subject: [PATCH] Revert "align: Add a room before '*' for arguments" This reverts commit d608680946934ec4a9f1fe73c2b86f84639f802c. --- gnome-align.el | 33 +++++++++------------------------ gnome-tests.el | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/gnome-align.el b/gnome-align.el index 6e68dc88a..7ac94aa6b 100644 --- a/gnome-align.el +++ b/gnome-align.el @@ -48,17 +48,15 @@ (cl-defstruct (gnome-align--argument (:constructor nil) (:constructor gnome-align--make-argument (type-start - type-end - identifier-start - identifier-end - stars)) + type-end + identifier-start + identifier-end)) (:copier nil) (:predicate nil)) (type-start nil :read-only t) (type-end nil :read-only t) (identifier-start nil :read-only t) - (identifier-end nil :read-only t) - (stars 0 :read-only t)) + (identifier-end nil :read-only t)) (defun gnome-align--marker-column (marker) (save-excursion @@ -80,9 +78,7 @@ (defun gnome-align--arglist-identifier-start-column (arglist start-column) (let ((column start-column) - argument-column - (stars 0) - argument-stars) + argument-column) (dolist (argument arglist) (setq argument-column (+ start-column (gnome-align--argument-type-width argument))) @@ -92,11 +88,8 @@ (when (eq (preceding-char) ? ) (setq argument-column (1+ argument-column))))) (when (> argument-column column) - (setq column argument-column)) - (setq argument-stars (gnome-align--argument-stars argument)) - (when (> argument-stars stars) - (setq stars argument-stars))) - (+ column stars))) + (setq column argument-column))) + column)) (defun gnome-align--argument-identifier-width (argument) (if (gnome-align--argument-identifier-start argument) @@ -143,7 +136,6 @@ type-end identifier-start identifier-end - (stars 0) arglist last-token-start) (goto-char (point-max)) @@ -170,16 +162,9 @@ (unless (eq (char-after) ?,) (setq last-token-start (point-marker))))) (c-backward-syntactic-ws)) - (setq type-start last-token-start) - (save-excursion - (goto-char type-end) - (while (and (< type-start (point)) - (eq (preceding-char) ?*)) - (setq stars (1+ stars)) - (c-backward-token-2)))) + (setq type-start last-token-start)) (push (gnome-align--make-argument type-start type-end - identifier-start identifier-end - stars) + identifier-start identifier-end) arglist)) arglist)))) diff --git a/gnome-tests.el b/gnome-tests.el index 47fccc4b9..d4e311369 100644 --- a/gnome-tests.el +++ b/gnome-tests.el @@ -20,7 +20,7 @@ void g_gpg_ctx_clear_signers (GGpgCtx *ctx); ") (defconst gnome-test-program-1-aligned "\ -GGpgCtx *g_gpg_ctx_new (GError **error); +GGpgCtx *g_gpg_ctx_new (GError **error); typedef void (*GGpgProgressCallback) (gpointer user_data, const gchar *what, @@ -28,16 +28,16 @@ typedef void (*GGpgProgressCallback) (gpointer user_data, gint current, gint total); -void g_gpg_ctx_set_progress_callback (GGpgCtx *ctx, - GGpgProgressCallback callback, - gpointer user_data, - GDestroyNotify destroy_data); -void g_gpg_ctx_add_signer (GGpgCtx *ctx, - GGpgKey *key); -guint g_gpg_ctx_get_n_signers (GGpgCtx *ctx); -GGpgKey *g_gpg_ctx_get_signer (GGpgCtx *ctx, - guint index); -void g_gpg_ctx_clear_signers (GGpgCtx *ctx); +void g_gpg_ctx_set_progress_callback (GGpgCtx *ctx, + GGpgProgressCallback callback, + gpointer user_data, + GDestroyNotify destroy_data); +void g_gpg_ctx_add_signer (GGpgCtx *ctx, + GGpgKey *key); +guint g_gpg_ctx_get_n_signers (GGpgCtx *ctx); +GGpgKey *g_gpg_ctx_get_signer (GGpgCtx *ctx, + guint index); +void g_gpg_ctx_clear_signers (GGpgCtx *ctx); ") (defconst gnome-test-program-2 "\ @@ -65,7 +65,7 @@ const gchar ** gtk_widget_list_action_prefixes (GtkWidget * (let ((columns (gnome-align--compute-optimal-columns (point-min) (point-max)))) (should (= (cdr (assq 'identifier-start-column columns)) 9)) (should (= (cdr (assq 'arglist-start-column columns)) 41)) - (should (= (cdr (assq 'arglist-identifier-start-column columns)) 64))))) + (should (= (cdr (assq 'arglist-identifier-start-column columns)) 63))))) (ert-deftest gnome-test-align-region () "Tests the `gnome-align-region'." -- 2.39.2