Alignment bug with comments/forms following a closing delimiter

オープン
#525 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
emacs-lisp
領域
tooling

調査の方向性

M-x clojure-align の実装から始め、特にレポートで説明されている clojure-cond-align-forms の経路を確認します。Emacs バッファーで例を再現し、閉じる区切り文字、コメント、後続のアライメント列がどのように測定されるかを追跡します。繰り返しアライメントしても結果が冪等であり、列挙されたすべての例が変更されないことを完了条件とします。

索引モデルが issue の本文から書いたものです。

説明

Expected behavior

M-x clojure-align on the following forms should be a no-op:

{:a [123
     456
     789] :b 10}

(cond foo  {:bar 1  ; initialize the Bar
            :baz 2} ; and the Baz
      quux {})

Actual behavior

The second "column" is pushed farther and farther to the right every time clojure-align is called.

{:a [123
     456
     789] :b 10}

=>

{:a       [123
           456
           789] :b 10}

=>

{:a             [123
                 456
                 789] :b 10}

=>

{:a                   [123
                       456
                       789] :b 10}

Steps to reproduce the problem

Execute clojure-align on any hashmap or function defined in clojure-cond-align-forms, which has a symbol or comment following a closing delimiter that is on a different line from its opening delimiter:

;; this is fine
{:a [1 2] ; comment
 }

;; this is also fine
{:a [[1
      2] ; comment
     3]
 }

;; but not this
{:a [1
     2
     3] ; comment
 }

The offending delimiter must belong to the second or greater "column" of the alignment

;; This is alright
(are [x y z] (= (count y) x (inc z))
  [100
   200
   300] 3 2)

;; This is not
(are [x y z] (= x (count y) (inc z))
  3 [100
     200
     300] 2)

Environment & Version information

clojure-mode version information

Include here the version string displayed by M-x clojure-mode-display-version. Here's an example:

clojure-mode (version 5.10.0)
Emacs version

26.2

Operating system

macOS 10.14

主要言語
Emacs Lisp
スター
1k
フォーク
249
平均マージ
1日 6時間
マージ済み PR(30日)
6

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

clojure-emacs/clojure-mode のほかの issue

clojure-emacs/clojure-mode の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。