有效的 Clojure 压头

发布于 2024-12-10 17:08:50 字数 6392 浏览 0 评论 0原文

我正在寻找一个编辑器/命令行程序,它可以正确(恕我直言)缩进Clojure代码,将第三个及后续元素与第二个元素对齐:

(let [foo (fun arg1
               arg2)

      bar (doto (Baz.)
                (.setProp abc123))

      [v1 v2] (fun2)

      [v3 v4] (fun3)]
  (xyzzy 42))

我已经尝试使用La Clojure for IntelliJ“通过第二个元素对齐Clojure表单”(不与第二个元素对齐),VimClojure,emacs(弄乱了 [v3 v4] 部分的缩进),Enclojure in Netbeans(不按第二个元素对齐)和 Eclipse 中的逆时针(不按第二个元素对齐)。在每种情况下,我都使用该软件的最新版本。

如有必要,我可以在编辑器外部(在命令行上)运行美化器。

这是 Aquamacs 的输出。请注意“级联”(make-day-panel)调用:

(defn make-mainframe [build-number project-version]
  "Create the mainframe.
  @param build-number the current build number
  @param project-version the Maven project version
  @returns the reified JFrame"
  (let [[^JToggleButton day-sheets-button
         ^JToggleButton summaries-button]
        (let [day-sheets-button
              (doto (JToggleButton. "Day Sheets")
                (.setToolTipText
                 "Switch to the Day Sheets view"))

              summaries-button
              (doto (JToggleButton. "Summaries")
                (.setToolTipText "Switch to the Summaries view"))]
          (doto (ButtonGroup.)
            (.add day-sheets-button)
            (.add summaries-button))
          (.setSelected day-sheets-button true)
          [day-sheets-button summaries-button])

        [^JPanel monday-panel
         monday-button
         monday-vacation-check
         monday-arrive-text-field
         monday-depart-text-field] (make-day-panel "Monday")

         [^JPanel tuesday-panel
          tuesday-button
          tuesday-vacation-check
          tuesday-arrive-text-field
          tuesday-depart-text-field] (make-day-panel "Tuesday")

          [^JPanel wednesday-panel
           wednesday-button
           wednesday-vacation-check
           wednesday-arrive-text-field
           wednesday-depart-text-field] (make-day-panel "Wednesday")

           [^JPanel thursday-panel
            thursday-button
            thursday-vacation-check
            thursday-arrive-text-field
            thursday-depart-text-field] (make-day-panel "Thursday")

            [^JPanel friday-panel
             friday-button
             friday-vacation-check
             friday-arrive-text-field
             friday-depart-text-field] (make-day-panel "Friday")

             [^JPanel saturday-panel
              saturday-button
              saturday-vacation-check
              saturday-arrive-text-field
              saturday-depart-text-field] (make-day-panel "Saturday")

              [^JPanel sunday-panel
               sunday-button
               sunday-vacation-check
               sunday-arrive-text-field
               sunday-depart-text-field] (make-day-panel "Sunday")

        #_ [week-selector-panel week-selector-combobox week-selector-today-button]
        #_ (make-week-selector)

        north-panel
        (let [^JPanel panel (JPanel.)]
          (doto panel
            (.setLayout (BoxLayout. panel BoxLayout/X_AXIS))
            (.add day-sheets-button)
            (.add (Box/createHorizontalStrut 5))
            (.add summaries-button)
            (.add (Box/createHorizontalGlue))
            #_ (.add week-selector-panel)))

        ^JToggleButton mail-button
        (make-button "Mail Report"
                     (make-icon "email-32x32-plain.png")
                     "Generate and send a weekly report for the currently selected week")

        ^JToggleButton report-button
        (make-button "Report"
                     (make-icon "history2-32x32-plain.png")
                     "Generate a weekly report for the currently selected week")

        day-sheet-panel
        (let [panel (JPanel. (BorderLayout.))

              north-panel (grid-bag-container (JPanel. (GridBagLayout.))
                                              {:insets (Insets. 2 2 2 2)}
                                              [[(doto (JPanel. (GridLayout. 1 0))
                                                  (.add report-button)
                                                  (.add mail-button))]
                                               [(Box/createHorizontalGlue)
                                                :weightx 1.0 :fill :HORIZONTAL ]
                                               [(doto (JPanel. (GridLayout. 1 0))
                                                  (.add monday-panel)
                                                  (.add tuesday-panel)
                                                  (.add wednesday-panel)
                                                  (.add thursday-panel)
                                                  (.add friday-panel)
                                                  (.add saturday-panel)
                                                  (.add sunday-panel))]])]
          (doto panel
            (.add north-panel BorderLayout/NORTH)
            (.setBorder (BorderFactory/createRaisedBevelBorder))))

        summaries-panel (let [panel (JPanel.)]
                          (doto panel))

        card-panel (let [panel (JPanel. (CardLayout.))]
                     (doto panel
                       (.add day-sheet-panel day-sheet-panel-key)
                       (.add summaries-panel summaries-panel-key)))

        main-panel (doto (JPanel. (BorderLayout.))
                     (.setBorder
                      (BorderFactory/createEmptyBorder default-border default-border
                                                       default-border default-border))
                     (.add north-panel BorderLayout/NORTH)
                     (.add card-panel))

        frame (doto (JFrame. (str "SpareTime (version " project-version ", build "
                                  build-number ")"))
                (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
                (.add main-panel))]
    (reify mainview-methods
      (frame-add-component-listener [_ listener] (.addComponentListener frame listener))
      (frame-center [_] (.setLocationRelativeTo frame nil))
      (frame-get-location [_] (.getLocation frame))
      (frame-get-size [_] (.getSize frame))
      (frame-set-location [_ x y] (.setLocation frame x y))
      (frame-set-size [_ width height] (.setSize frame (Dimension. width height)))
      (frame-set-visible [_ visible] (.setVisible frame visible)))))

I am looking for an editor/command line program that properly (IMHO) indents Clojure code, aligning the third and subsequent elements with the second element:

(let [foo (fun arg1
               arg2)

      bar (doto (Baz.)
                (.setProp abc123))

      [v1 v2] (fun2)

      [v3 v4] (fun3)]
  (xyzzy 42))

I have tried La Clojure for IntelliJ with the "Align Clojure forms by the second element" (does not align by the second element), VimClojure, emacs (messed up the indentation of the [v3 v4] part), Enclojure in Netbeans (does not align by the second element), and Counterclockwise in Eclipse (does not align by the second element). In each case, I am using the latest version of the software.

I can run a beautifier outside of the editor (on the command line) if necessary.

Here is the output of Aquamacs. Note the "cascading" (make-day-panel) calls:

(defn make-mainframe [build-number project-version]
  "Create the mainframe.
  @param build-number the current build number
  @param project-version the Maven project version
  @returns the reified JFrame"
  (let [[^JToggleButton day-sheets-button
         ^JToggleButton summaries-button]
        (let [day-sheets-button
              (doto (JToggleButton. "Day Sheets")
                (.setToolTipText
                 "Switch to the Day Sheets view"))

              summaries-button
              (doto (JToggleButton. "Summaries")
                (.setToolTipText "Switch to the Summaries view"))]
          (doto (ButtonGroup.)
            (.add day-sheets-button)
            (.add summaries-button))
          (.setSelected day-sheets-button true)
          [day-sheets-button summaries-button])

        [^JPanel monday-panel
         monday-button
         monday-vacation-check
         monday-arrive-text-field
         monday-depart-text-field] (make-day-panel "Monday")

         [^JPanel tuesday-panel
          tuesday-button
          tuesday-vacation-check
          tuesday-arrive-text-field
          tuesday-depart-text-field] (make-day-panel "Tuesday")

          [^JPanel wednesday-panel
           wednesday-button
           wednesday-vacation-check
           wednesday-arrive-text-field
           wednesday-depart-text-field] (make-day-panel "Wednesday")

           [^JPanel thursday-panel
            thursday-button
            thursday-vacation-check
            thursday-arrive-text-field
            thursday-depart-text-field] (make-day-panel "Thursday")

            [^JPanel friday-panel
             friday-button
             friday-vacation-check
             friday-arrive-text-field
             friday-depart-text-field] (make-day-panel "Friday")

             [^JPanel saturday-panel
              saturday-button
              saturday-vacation-check
              saturday-arrive-text-field
              saturday-depart-text-field] (make-day-panel "Saturday")

              [^JPanel sunday-panel
               sunday-button
               sunday-vacation-check
               sunday-arrive-text-field
               sunday-depart-text-field] (make-day-panel "Sunday")

        #_ [week-selector-panel week-selector-combobox week-selector-today-button]
        #_ (make-week-selector)

        north-panel
        (let [^JPanel panel (JPanel.)]
          (doto panel
            (.setLayout (BoxLayout. panel BoxLayout/X_AXIS))
            (.add day-sheets-button)
            (.add (Box/createHorizontalStrut 5))
            (.add summaries-button)
            (.add (Box/createHorizontalGlue))
            #_ (.add week-selector-panel)))

        ^JToggleButton mail-button
        (make-button "Mail Report"
                     (make-icon "email-32x32-plain.png")
                     "Generate and send a weekly report for the currently selected week")

        ^JToggleButton report-button
        (make-button "Report"
                     (make-icon "history2-32x32-plain.png")
                     "Generate a weekly report for the currently selected week")

        day-sheet-panel
        (let [panel (JPanel. (BorderLayout.))

              north-panel (grid-bag-container (JPanel. (GridBagLayout.))
                                              {:insets (Insets. 2 2 2 2)}
                                              [[(doto (JPanel. (GridLayout. 1 0))
                                                  (.add report-button)
                                                  (.add mail-button))]
                                               [(Box/createHorizontalGlue)
                                                :weightx 1.0 :fill :HORIZONTAL ]
                                               [(doto (JPanel. (GridLayout. 1 0))
                                                  (.add monday-panel)
                                                  (.add tuesday-panel)
                                                  (.add wednesday-panel)
                                                  (.add thursday-panel)
                                                  (.add friday-panel)
                                                  (.add saturday-panel)
                                                  (.add sunday-panel))]])]
          (doto panel
            (.add north-panel BorderLayout/NORTH)
            (.setBorder (BorderFactory/createRaisedBevelBorder))))

        summaries-panel (let [panel (JPanel.)]
                          (doto panel))

        card-panel (let [panel (JPanel. (CardLayout.))]
                     (doto panel
                       (.add day-sheet-panel day-sheet-panel-key)
                       (.add summaries-panel summaries-panel-key)))

        main-panel (doto (JPanel. (BorderLayout.))
                     (.setBorder
                      (BorderFactory/createEmptyBorder default-border default-border
                                                       default-border default-border))
                     (.add north-panel BorderLayout/NORTH)
                     (.add card-panel))

        frame (doto (JFrame. (str "SpareTime (version " project-version ", build "
                                  build-number ")"))
                (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
                (.add main-panel))]
    (reify mainview-methods
      (frame-add-component-listener [_ listener] (.addComponentListener frame listener))
      (frame-center [_] (.setLocationRelativeTo frame nil))
      (frame-get-location [_] (.getLocation frame))
      (frame-get-size [_] (.getSize frame))
      (frame-set-location [_ x y] (.setLocation frame x y))
      (frame-set-size [_ width height] (.setSize frame (Dimension. width height)))
      (frame-set-visible [_ visible] (.setVisible frame visible)))))

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

感情洁癖 2024-12-17 17:08:50

据我所知,当前的 clojure 模式缩进如您所愿,只是它将 doto 处理为特殊(也就是说,它从第三形式开始缩进以使“目标”更加突出) 。

我的 emacs 24 上的 indent-sexp 输出,带有来自 marmalade 的 clojure 模式:

(let [foo (fun arg1
               arg2)

      bar (doto (Baz.)
            (.setProp abc123))

      [v1 v2] (fun2)

      [v3 v4] (fun3)]
  (xyzzy 42))

我认为你要么有一个损坏的 clojure 模式,要么 aquamacs 再次变得不同和困难。我真的建议在 OSX 上使用标准 Gnu emacs - 只要你将元映射到命令以外的东西,你就可以在标准 emacs 中使用大多数简单的标准 osx 组合键(command-c、command-v、command-s 等) 。

附录:该大代码块的输出(注意 make-day-panel 调用的正确位置):

(defn make-mainframe [build-number project-version]
  "Create the mainframe.
  @param build-number the current build number
  @param project-version the Maven project version
  @returns the reified JFrame"
  (let [[^JToggleButton day-sheets-button
         ^JToggleButton summaries-button]
        (let [day-sheets-button
              (doto (JToggleButton. "Day Sheets")
                (.setToolTipText
                 "Switch to the Day Sheets view"))

              summaries-button
              (doto (JToggleButton. "Summaries")
                (.setToolTipText "Switch to the Summaries view"))]
          (doto (ButtonGroup.)
            (.add day-sheets-button)
            (.add summaries-button))
          (.setSelected day-sheets-button true)
          [day-sheets-button summaries-button])

        [^JPanel monday-panel
         monday-button
         monday-vacation-check
         monday-arrive-text-field
         monday-depart-text-field] (make-day-panel "Monday")

        [^JPanel tuesday-panel
         tuesday-button
         tuesday-vacation-check
         tuesday-arrive-text-field
         tuesday-depart-text-field] (make-day-panel "Tuesday")

        [^JPanel wednesday-panel
         wednesday-button
         wednesday-vacation-check
         wednesday-arrive-text-field
         wednesday-depart-text-field] (make-day-panel "Wednesday")

        [^JPanel thursday-panel
         thursday-button
         thursday-vacation-check
         thursday-arrive-text-field
         thursday-depart-text-field] (make-day-panel "Thursday")

        [^JPanel friday-panel
         friday-button
         friday-vacation-check
         friday-arrive-text-field
         friday-depart-text-field] (make-day-panel "Friday")

        [^JPanel saturday-panel
         saturday-button
         saturday-vacation-check
         saturday-arrive-text-field
         saturday-depart-text-field] (make-day-panel "Saturday")

        [^JPanel sunday-panel
         sunday-button
         sunday-vacation-check
         sunday-arrive-text-field
         sunday-depart-text-field] (make-day-panel "Sunday")

        #_ [week-selector-panel week-selector-combobox week-selector-today-button]
        #_ (make-week-selector)

        north-panel
        (let [^JPanel panel (JPanel.)]
          (doto panel
            (.setLayout (BoxLayout. panel BoxLayout/X_AXIS))
            (.add day-sheets-button)
            (.add (Box/createHorizontalStrut 5))
            (.add summaries-button)
            (.add (Box/createHorizontalGlue))
            #_ (.add week-selector-panel)))

        ^JToggleButton mail-button
        (make-button "Mail Report"
                     (make-icon "email-32x32-plain.png")
                     "Generate and send a weekly report for the currently selected week")

        ^JToggleButton report-button
        (make-button "Report"
                     (make-icon "history2-32x32-plain.png")
                     "Generate a weekly report for the currently selected week")

        day-sheet-panel
        (let [panel (JPanel. (BorderLayout.))

              north-panel (grid-bag-container (JPanel. (GridBagLayout.))
                                              {:insets (Insets. 2 2 2 2)}
                                              [[(doto (JPanel. (GridLayout. 1 0))
                                                  (.add report-button)
                                                  (.add mail-button))]
                                               [(Box/createHorizontalGlue)
                                                :weightx 1.0 :fill :HORIZONTAL ]
                                               [(doto (JPanel. (GridLayout. 1 0))
                                                  (.add monday-panel)
                                                  (.add tuesday-panel)
                                                  (.add wednesday-panel)
                                                  (.add thursday-panel)
                                                  (.add friday-panel)
                                                  (.add saturday-panel)
                                                  (.add sunday-panel))]])]
          (doto panel
            (.add north-panel BorderLayout/NORTH)
            (.setBorder (BorderFactory/createRaisedBevelBorder))))

        summaries-panel (let [panel (JPanel.)]
                          (doto panel))

        card-panel (let [panel (JPanel. (CardLayout.))]
                     (doto panel
                       (.add day-sheet-panel day-sheet-panel-key)
                       (.add summaries-panel summaries-panel-key)))

        main-panel (doto (JPanel. (BorderLayout.))
                     (.setBorder
                      (BorderFactory/createEmptyBorder default-border default-border
                                                       default-border default-border))
                     (.add north-panel BorderLayout/NORTH)
                     (.add card-panel))

        frame (doto (JFrame. (str "SpareTime (version " project-version ", build "
                                  build-number ")"))
                (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
                (.add main-panel))]
    (reify mainview-methods
      (frame-add-component-listener [_ listener] (.addComponentListener frame listener))
      (frame-center [_] (.setLocationRelativeTo frame nil))
      (frame-get-location [_] (.getLocation frame))
      (frame-get-size [_] (.getSize frame))
      (frame-set-location [_ x y] (.setLocation frame x y))
      (frame-set-size [_ width height] (.setSize frame (Dimension. width height)))
      (frame-set-visible [_ visible] (.setVisible frame visible)))))

As far as I can tell, current clojure-mode indents like you want except that it handles doto as special (that is, it indents from the third form onwards to make the "target" stand out more).

Output for indent-sexp on my emacs 24 with clojure-mode from marmalade:

(let [foo (fun arg1
               arg2)

      bar (doto (Baz.)
            (.setProp abc123))

      [v1 v2] (fun2)

      [v3 v4] (fun3)]
  (xyzzy 42))

I think you've either got a broken clojure-mode, or aquamacs is being different and difficult again. I really recommend using standard Gnu emacs on OSX - as long as you map meta to something other than command, you can use most of the simple standard osx key combos (command-c, command-v, command-s etc) in standard emacs.

Addendum: output for that large code block (note correct placement of make-day-panel calls):

(defn make-mainframe [build-number project-version]
  "Create the mainframe.
  @param build-number the current build number
  @param project-version the Maven project version
  @returns the reified JFrame"
  (let [[^JToggleButton day-sheets-button
         ^JToggleButton summaries-button]
        (let [day-sheets-button
              (doto (JToggleButton. "Day Sheets")
                (.setToolTipText
                 "Switch to the Day Sheets view"))

              summaries-button
              (doto (JToggleButton. "Summaries")
                (.setToolTipText "Switch to the Summaries view"))]
          (doto (ButtonGroup.)
            (.add day-sheets-button)
            (.add summaries-button))
          (.setSelected day-sheets-button true)
          [day-sheets-button summaries-button])

        [^JPanel monday-panel
         monday-button
         monday-vacation-check
         monday-arrive-text-field
         monday-depart-text-field] (make-day-panel "Monday")

        [^JPanel tuesday-panel
         tuesday-button
         tuesday-vacation-check
         tuesday-arrive-text-field
         tuesday-depart-text-field] (make-day-panel "Tuesday")

        [^JPanel wednesday-panel
         wednesday-button
         wednesday-vacation-check
         wednesday-arrive-text-field
         wednesday-depart-text-field] (make-day-panel "Wednesday")

        [^JPanel thursday-panel
         thursday-button
         thursday-vacation-check
         thursday-arrive-text-field
         thursday-depart-text-field] (make-day-panel "Thursday")

        [^JPanel friday-panel
         friday-button
         friday-vacation-check
         friday-arrive-text-field
         friday-depart-text-field] (make-day-panel "Friday")

        [^JPanel saturday-panel
         saturday-button
         saturday-vacation-check
         saturday-arrive-text-field
         saturday-depart-text-field] (make-day-panel "Saturday")

        [^JPanel sunday-panel
         sunday-button
         sunday-vacation-check
         sunday-arrive-text-field
         sunday-depart-text-field] (make-day-panel "Sunday")

        #_ [week-selector-panel week-selector-combobox week-selector-today-button]
        #_ (make-week-selector)

        north-panel
        (let [^JPanel panel (JPanel.)]
          (doto panel
            (.setLayout (BoxLayout. panel BoxLayout/X_AXIS))
            (.add day-sheets-button)
            (.add (Box/createHorizontalStrut 5))
            (.add summaries-button)
            (.add (Box/createHorizontalGlue))
            #_ (.add week-selector-panel)))

        ^JToggleButton mail-button
        (make-button "Mail Report"
                     (make-icon "email-32x32-plain.png")
                     "Generate and send a weekly report for the currently selected week")

        ^JToggleButton report-button
        (make-button "Report"
                     (make-icon "history2-32x32-plain.png")
                     "Generate a weekly report for the currently selected week")

        day-sheet-panel
        (let [panel (JPanel. (BorderLayout.))

              north-panel (grid-bag-container (JPanel. (GridBagLayout.))
                                              {:insets (Insets. 2 2 2 2)}
                                              [[(doto (JPanel. (GridLayout. 1 0))
                                                  (.add report-button)
                                                  (.add mail-button))]
                                               [(Box/createHorizontalGlue)
                                                :weightx 1.0 :fill :HORIZONTAL ]
                                               [(doto (JPanel. (GridLayout. 1 0))
                                                  (.add monday-panel)
                                                  (.add tuesday-panel)
                                                  (.add wednesday-panel)
                                                  (.add thursday-panel)
                                                  (.add friday-panel)
                                                  (.add saturday-panel)
                                                  (.add sunday-panel))]])]
          (doto panel
            (.add north-panel BorderLayout/NORTH)
            (.setBorder (BorderFactory/createRaisedBevelBorder))))

        summaries-panel (let [panel (JPanel.)]
                          (doto panel))

        card-panel (let [panel (JPanel. (CardLayout.))]
                     (doto panel
                       (.add day-sheet-panel day-sheet-panel-key)
                       (.add summaries-panel summaries-panel-key)))

        main-panel (doto (JPanel. (BorderLayout.))
                     (.setBorder
                      (BorderFactory/createEmptyBorder default-border default-border
                                                       default-border default-border))
                     (.add north-panel BorderLayout/NORTH)
                     (.add card-panel))

        frame (doto (JFrame. (str "SpareTime (version " project-version ", build "
                                  build-number ")"))
                (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
                (.add main-panel))]
    (reify mainview-methods
      (frame-add-component-listener [_ listener] (.addComponentListener frame listener))
      (frame-center [_] (.setLocationRelativeTo frame nil))
      (frame-get-location [_] (.getLocation frame))
      (frame-get-size [_] (.getSize frame))
      (frame-set-location [_ x y] (.setLocation frame x y))
      (frame-set-size [_ width height] (.setSize frame (Dimension. width height)))
      (frame-set-visible [_ visible] (.setVisible frame visible)))))
诠释孤独 2024-12-17 17:08:50

据我所知,如果您在缩进延续的同一行上开始一个全新的 sexp,Emacs 缩进器无法理解发生了什么,这就是上面的 let 所做的。 当然,你会看到类似的问题

(if (< 1 (- 3
            1) 3
            4))

,一开始就这样写并不是很好的风格,所以也许 Emacs 可以原谅。正如您所指出的,像这样的代码更有可能出现在 Clojure 中的 letcond 中,而且它的风格不错 - 但 Emacs 压痕器是为其他 lisp 设计的,这要求每一对都用括号括起来:

(let [([x
        y
        z] (foo))
      ([a
        b
        c] (bar))]
  ...)

正如您所看到的,缩进很好。所以我认为在某些时候有人必须弄清楚如何针对这种情况更新 Emacs 压头,这比让其他编辑器达到 Emacs 的水平要容易得多。也许那个人应该是你,如果它困扰着你——我想是开源的魔力和负担。

As far as I can tell the Emacs indenter doesn't understand what's going on if you start an entirely-new sexp on the same line as an indented continuation, which is what your let above does. You see a similar problem with

(if (< 1 (- 3
            1) 3
            4))

Of course, writing that to begin with is not very good style, so perhaps Emacs can be excused. Code shaped like this is more likely to appear in let or cond in Clojure, as you noted, and it's not bad style - but the Emacs indenter was designed for other lisps, which require each pair to be wrapped in parentheses:

(let [([x
        y
        z] (foo))
      ([a
        b
        c] (bar))]
  ...)

And as you can see, that indents fine. So I think at some point someone will have to figure out how to update the Emacs indenter for this case, and that this will be way easier than getting some other editor up to Emacs's level. Perhaps that person should be you, if it's bothering you - the magic and the burden of open-source, I suppose.

风筝有风,海豚有海 2024-12-17 17:08:50

当您从 lispwords 中删除 doto 时,VimClojure 会按照您想要的方式缩进(如果我正确理解您的示例)。

setlocal lispwords-=doto

VimClojure will indent the way you want (if I understand your example correctly), when you remove doto from lispwords.

setlocal lispwords-=doto
梦明 2024-12-17 17:08:50

LightTable 的缩进方式与 Joost 帖子示例中的 Emacs 相同:

(let [foo (fun arg1
               arg2)

      bar (doto (Baz.)
            (.setProp abc123))

      [v1 v2] (fun2)

      [v3 v4] (fun3)]
  (xyzzy 42))

如果你问我的话,那很好。根据我的经验,它比 IDEA、Sublime Text 或 Netbeans 效果更好。如果您不是 Vim / Emacs 用户,值得一试。它仍处于早期阶段,但显示出很大的希望。它的设计考虑了 Clojure。

LightTable indents it the same way as Emacs in the example from Joost's post:

(let [foo (fun arg1
               arg2)

      bar (doto (Baz.)
            (.setProp abc123))

      [v1 v2] (fun2)

      [v3 v4] (fun3)]
  (xyzzy 42))

Pretty good if you ask me. From my experience, it works better than IDEA, Sublime Text or Netbeans. Worth checking out if you're not a Vim / Emacs user. It's still in an early phase, but shows a lot of promise. And it was designed with Clojure in mind.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文