From unknown Sat Aug 16 11:40:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16811: 24.3.50; [ruby-mode] Implicit hash indentation bug Resent-From: Bozhidar Batsov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Feb 2014 17:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16811 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 16811@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.139283190913040 (code B ref -1); Wed, 19 Feb 2014 17:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 19 Feb 2014 17:45:09 +0000 Received: from localhost ([127.0.0.1]:60526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGBCl-0003OE-U5 for submit@debbugs.gnu.org; Wed, 19 Feb 2014 12:45:09 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36770) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGBCg-0003NR-IE for submit@debbugs.gnu.org; Wed, 19 Feb 2014 12:45:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGBCR-0006uA-5k for submit@debbugs.gnu.org; Wed, 19 Feb 2014 12:44:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:40931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGBCR-0006u2-1i for submit@debbugs.gnu.org; Wed, 19 Feb 2014 12:44:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGBCJ-0003q6-Lk for bug-gnu-emacs@gnu.org; Wed, 19 Feb 2014 12:44:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGBCC-0006mS-8v for bug-gnu-emacs@gnu.org; Wed, 19 Feb 2014 12:44:39 -0500 Received: from mail-ea0-f172.google.com ([209.85.215.172]:61993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGBCB-0006kl-Vo for bug-gnu-emacs@gnu.org; Wed, 19 Feb 2014 12:44:32 -0500 Received: by mail-ea0-f172.google.com with SMTP id l9so531043eaj.3 for ; Wed, 19 Feb 2014 09:44:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-type; bh=uSP/IkBNcgJNcxm8v9C9eoSX5H+LCVNQjEv482J6pj4=; b=W3igenLNoggMi3VnmkN2k+3jY24ckyUwT/u0D2xdreYK1zOEIX0k9GsdJzKVPxVVDt /sKAW4fXRK/C3mzIt7rRuDHw4/oAC9DVzgniFazA0G6NKFg4Wf1Nd3jvnkGtDAX25Dks ++PtOp4n/cWn3dh26HaRXjPi+AWtvKJ3ptHDn6zlJoebojv95esQ0uQdSwQqsHxsVWTB U40tdX5+qQ0vcPG0cbNEBnIhoo4blaw+BVuQiDh0HlYZRHHSNwMvtTkKtVZZhgq4FP4t GmaDFXcngyxjoly3izoaISAimXTCa3yPKrqEbuWulhMyH29PGI2OG/bO7fSgIrqBqR68 VpEg== X-Gm-Message-State: ALoCoQlzmERs7mY0oDnru+1V1ioYf33yZr5U+wcTY6SrKwMG98nC06MW6pm6EldbbrJgXrtmUsry X-Received: by 10.15.23.194 with SMTP id h42mr41330924eeu.32.1392831870148; Wed, 19 Feb 2014 09:44:30 -0800 (PST) Received: from Bozhidars-MacBook-Pro.local ([95.87.231.111]) by mx.google.com with ESMTPSA id u6sm3244641eep.11.2014.02.19.09.44.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 19 Feb 2014 09:44:29 -0800 (PST) Received: by Bozhidars-MacBook-Pro.local (Postfix, from userid 501) id A6EE0819A901; Wed, 19 Feb 2014 19:44:25 +0200 (EET) From: Bozhidar Batsov Date: Wed, 19 Feb 2014 19:44:25 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This nested hash literal is indented correctly: { 'HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, 'SpaceAroundOperators' => { 'Enabled' => true } } This one, however, is not: method('HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, 'SpaceAroundOperators' => { 'Enabled' => true }) Should be: method('HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, 'SpaceAroundOperators' => { 'Enabled' => true }) The fact that the hash is implicit (lacking {}) seems to mess with the indentation logic. In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00) of 2014-01-27 on Bozhidars-MacBook-Pro.local Windowing system distributor `Apple', version 10.3.1265 Configured using: `configure --prefix=/usr/local/Cellar/emacs/HEAD --without-dbus --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs/HEAD/share/info/emacs --without-gnutls --with-ns --disable-ns-self-contained' Important settings: locale-coding-system: utf-8-unix Major mode: Ruby Minor modes in effect: ruby-tools-mode: t inf-ruby-minor-mode: t diff-auto-refine-mode: t subword-mode: t guru-mode: t erc-truncate-mode: t erc-spelling-mode: t erc-list-mode: t erc-menu-mode: t erc-autojoin-mode: t erc-ring-mode: t erc-networks-mode: t erc-pcomplete-mode: t erc-track-mode: t erc-match-mode: t erc-button-mode: t erc-fill-mode: t erc-stamp-mode: t erc-netsplit-mode: t erc-irccontrols-mode: t erc-noncommands-mode: t erc-move-to-prompt-mode: t erc-readonly-mode: t global-flycheck-mode: t flycheck-mode: t which-function-mode: t flx-ido-mode: t ido-ubiquitous-mode: t winner-mode: t global-undo-tree-mode: t undo-tree-mode: t whitespace-mode: t global-anzu-mode: t anzu-mode: t projectile-global-mode: t projectile-mode: t flyspell-mode: t volatile-highlights-mode: t global-hl-line-mode: t shell-dirtrack-mode: t recentf-mode: t savehist-mode: t show-smartparens-global-mode: t show-smartparens-mode: t smartparens-mode: t global-auto-revert-mode: t delete-selection-mode: t prelude-global-mode: t prelude-mode: t tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f l M-p C-a M-( g e t - b u f f e r - p r o c e s s SPC C-p C-p C-= M-w C-x b t e s t . r b C-g s-r t e s t . r b C-x b r b C-s C-s C-s C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-SPC C-n C-n C-n C-n C-n C-e C-p C-e C-b M-w C-x b C-y C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-a C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k { C-d SPC C-j C-n C-n C-n C-n C-e } C-x b C-p C-p C-p C-p C-a C-SPC C-n C-n C-n C-n C-e M-w C-x b C-y C-p C-p C-p C-p C-a C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d m e t h o d C-n C-n C-n C-n C-e C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-a M-x r e p o r t Recent messages: Wrote /Users/bozhidar/projects/test.rb Mark set [2 times] Indenting region...done Saving file /Users/bozhidar/projects/test.rb... Wrote /Users/bozhidar/projects/test.rb Mark set [2 times] Indenting region...done Align the elements of a hash literal if they span more than one line. Beginning of buffer Literal { Load-path shadows: /Users/bozhidar/.emacs.d/elpa/tabulated-list-20120406.2251/tabulated-list hides /usr/local/Cellar/emacs/HEAD/share/emacs/24.3.50/lisp/emacs-lisp/tabulated-list Features: (shadow sort emacsbug ielm jka-compr package-build json-fix json rect vc-annotate vc vc-dispatcher hippie-exp yaml-mode ace-jump-mode mail-extr ffap url-parse url-vars css-mode-expansions css-mode scss-mode flymake ruby-tools inf-ruby ruby-mode-expansions smartparens-ruby ruby-mode smie markdown-mode noutline outline mule-util eieio-opt speedbar sb-image ezimage dframe find-dired misearch multi-isearch magit-key-mode magit view epa derived epg epg-config diff-mode git-rebase-mode git-commit-mode server log-edit message sendmail rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log vc-git executable lisp-mnt network-stream starttls tls cider cider-mode cider-repl cider-eldoc clojure-test-mode cider-interaction arc-mode archive-mode cider-client nrepl-client cider-util ewoc superword subword clojure-mode-expansions clojure-mode inf-lisp rainbow-mode color rainbow-delimiters elisp-slime-nav guru-mode prelude-key-chord key-chord prelude-xml nxml-mode-expansions html-mode-expansions sgml-mode smartparens-html rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok prelude-web prelude-scss prelude-scheme prelude-ruby prelude-perl prelude-org prelude-js prelude-erc erc-truncate erc-autoaway erc-spelling erc-notify erc-log erc-list erc-menu erc-join erc-ring erc-networks erc-pcomplete erc-track erc-match erc-button erc-fill erc-stamp erc-netsplit erc-goodies erc erc-backend erc-compat prelude-emacs-lisp prelude-css prelude-common-lisp slime-autoloads prelude-clojure prelude-lisp prelude-c prelude-programming flycheck help-mode rx f which-func imenu prelude-ido smex flx-ido flx ido-ubiquitous warnings ido prelude-osx exec-path-from-shell prelude-global-keybindings prelude-editor winner undo-tree diff esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg eldoc esh-groups eshell esh-module esh-mode esh-util re-builder whitespace browse-kill-ring midnight ediff-merg ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff dired-x dired anzu projectile pkg-info find-func grep compile s bookmark pp expand-region text-mode-expansions er-basic-expansions expand-region-core expand-region-custom flyspell ispell etags volatile-highlights hl-line windmove tramp-cache tramp-sh tramp tramp-compat auth-source gnus-util mm-util mail-prsvr password-cache tramp-loaddefs trampver shell pcomplete comint ansi-color ring format-spec recentf tree-widget wid-edit savehist saveplace diminish smartparens-config smartparens autorevert filenotify delsel prelude-mode easy-mmode edmacro kmacro prelude-core epl advice help-fns dash thingatpt prelude-ui zenburn-theme prelude-packages finder-inf ack-and-a-half-autoloads diminish-autoloads erlang-autoloads flx-ido-autoloads eieio byte-opt bytecomp byte-compile cconv eieio-core grizzl-autoloads key-chord-autoloads logito-autoloads info easymenu cl-macs gv move-text-autoloads pkg-info-autoloads puppet-mode-autoloads rainbow-delimiters-autoloads request-autoloads rubocop-autoloads volatile-highlights-autoloads yaml-mode-autoloads package cl cl-loaddefs cl-lib time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process cocoa ns multi-tty emacs) From unknown Sat Aug 16 11:40:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16811: 24.3.50; [ruby-mode] Implicit hash indentation bug Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Feb 2014 06:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16811 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Bozhidar Batsov Cc: 16811@debbugs.gnu.org, Stefan Monnier Received: via spool by 16811-submit@debbugs.gnu.org id=B16811.139287734730901 (code B ref 16811); Thu, 20 Feb 2014 06:23:01 +0000 Received: (at 16811) by debbugs.gnu.org; 20 Feb 2014 06:22:27 +0000 Received: from localhost ([127.0.0.1]:32907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGN1e-00082K-C2 for submit@debbugs.gnu.org; Thu, 20 Feb 2014 01:22:26 -0500 Received: from mail-ea0-f182.google.com ([209.85.215.182]:58356) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGN1c-000827-9D for 16811@debbugs.gnu.org; Thu, 20 Feb 2014 01:22:25 -0500 Received: by mail-ea0-f182.google.com with SMTP id r15so667462ead.13 for <16811@debbugs.gnu.org>; Wed, 19 Feb 2014 22:22:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=Ck+L+gOq1ldCB91kCAq3/sZyz/w3s+lPS1LAiBPBluQ=; b=WOJcig34LH1jhLJ6x796R7cCel7AckhbvOyd3hvrIME3n7nqjZaNGlfI9kAnC1zpXh V8I4JDOzy8W08a0uhXN+HqyTl9OY2n8dcuNPEsR0YIainw//be3DZ1m4ZHswh+u4s+58 mrgugEbt3MVB6B4B223CzAd8THKWOJ0zXJfTNvqSbR+HJcVRLDNai8oONyTkcvMpDnBZ MJmxw8CIdY2B5jXfaz5Gi5Oe5SlN0q6j6zx/KoS5BMjLgIoDGVOc1w1qW8nd6DGSnkNJ Lm3s5gB8HYCWItrbxfZb9j48Cwc4PLnng7/ONKemr3iHFQdnAXydg/ieC72mJ9jaEbce 0o0A== X-Received: by 10.14.108.1 with SMTP id p1mr6559681eeg.97.1392877338473; Wed, 19 Feb 2014 22:22:18 -0800 (PST) Received: from axl ([93.109.195.252]) by mx.google.com with ESMTPSA id k41sm9617223een.19.2014.02.19.22.22.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 19 Feb 2014 22:22:17 -0800 (PST) From: Dmitry Gutov In-Reply-To: (Bozhidar Batsov's message of "Wed, 19 Feb 2014 19:44:25 +0200") References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Date: Thu, 20 Feb 2014 08:22:08 +0200 Message-ID: <87fvnes3qn.fsf@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Bozhidar Batsov writes: > Should be: > > method('HashSyntax' => { > 'EnforcedStyle' => 'ruby19', > 'SupportedStyles' => %w(ruby19 hash_rockets) > }, > 'SpaceAroundOperators' => { 'Enabled' => true }) > > The fact that the hash is implicit (lacking {}) seems to mess with the > indentation logic. Not really. The corresponding example with explicit hash would be {'HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, 'SpaceAroundOperators' => { 'Enabled' => true }} and it has the same problem. The problem seems to be that (let (smie--parent) (smie-indent--parent)) called between "=>" and "{" doesn't stop at "=>", but goes straight to the parent "{". Not sure how to fix that best with the current grammar. Stefan? From unknown Sat Aug 16 11:40:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16811: 24.3.50; [ruby-mode] Implicit hash indentation bug Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Feb 2014 14:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16811 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 16811@debbugs.gnu.org, Bozhidar Batsov Received: via spool by 16811-submit@debbugs.gnu.org id=B16811.139290547819049 (code B ref 16811); Thu, 20 Feb 2014 14:12:01 +0000 Received: (at 16811) by debbugs.gnu.org; 20 Feb 2014 14:11:18 +0000 Received: from localhost ([127.0.0.1]:33184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGULN-0004xB-LK for submit@debbugs.gnu.org; Thu, 20 Feb 2014 09:11:17 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:15112) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGULM-0004wx-9s for 16811@debbugs.gnu.org; Thu, 20 Feb 2014 09:11:16 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFLd/o4/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCwsOJhIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IPAS-Result: Av8EABK/CFFLd/o4/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCwsOJhIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="48227575" Received: from 75-119-250-56.dsl.teksavvy.com (HELO pastel.home) ([75.119.250.56]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 20 Feb 2014 09:11:10 -0500 Received: by pastel.home (Postfix, from userid 20848) id 9CFF4600EB; Thu, 20 Feb 2014 09:11:10 -0500 (EST) From: Stefan Monnier Message-ID: References: <87fvnes3qn.fsf@yandex.ru> Date: Thu, 20 Feb 2014 09:11:10 -0500 In-Reply-To: <87fvnes3qn.fsf@yandex.ru> (Dmitry Gutov's message of "Thu, 20 Feb 2014 08:22:08 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > The problem seems to be that (let (smie--parent) (smie-indent--parent)) Which does little more than (smie-backward-sexp 'halfsexp) in this case. > called between "=>" and "{" doesn't stop at "=>", but goes straight to > the parent "{". Which seems correct. > Not sure how to fix that best with the current grammar. Stefan? I haven't followed the ruby-smie code lately, so I'm a bit lost. But on the surface I'd say you might want to use (smie-rule-prev-p "=>")? This said, I don't understand why { 'HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, 'SpaceAroundOperators' => { 'Enabled' => true } } is indented differently from {'HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, 'SpaceAroundOperators' => { 'Enabled' => true }} It seems like "it jumps back to { instead of =>" is not the full explanation. Stefan From unknown Sat Aug 16 11:40:34 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Bozhidar Batsov Subject: bug#16811: closed (Re: bug#16811: 24.3.50; [ruby-mode] Implicit hash indentation bug) Message-ID: References: <53098D59.1000007@yandex.ru> X-Gnu-PR-Message: they-closed 16811 X-Gnu-PR-Package: emacs Reply-To: 16811@debbugs.gnu.org Date: Sun, 23 Feb 2014 05:56:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1393134964-32077-1" This is a multi-part message in MIME format... ------------=_1393134964-32077-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #16811: 24.3.50; [ruby-mode] Implicit hash indentation bug which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 16811@debbugs.gnu.org. --=20 16811: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D16811 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1393134964-32077-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 16811-done) by debbugs.gnu.org; 23 Feb 2014 05:55:52 +0000 Received: from localhost ([127.0.0.1]:36212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WHS2Z-0008L0-9W for submit@debbugs.gnu.org; Sun, 23 Feb 2014 00:55:51 -0500 Received: from mail-ee0-f48.google.com ([74.125.83.48]:62275) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WHS2W-0008Kf-7r for 16811-done@debbugs.gnu.org; Sun, 23 Feb 2014 00:55:48 -0500 Received: by mail-ee0-f48.google.com with SMTP id t10so2393115eei.35 for <16811-done@debbugs.gnu.org>; Sat, 22 Feb 2014 21:55:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=ynXdj6B0ungYvGoAObXF3qvt/ipHFws9BXCp5qDtM4w=; b=j+k+2eAckauA/FU6d6IfrWuZ8RbGYVxDXfn3Y9sGfPq874s4aGZQqwDrdrdhmsXDzH Os1JPCL/2jHBaHq3Sok0lwKvcb05po5gqdZG5gjupU42iI/ZZhfNyOkjKqAlcStlK9o2 TV/1ooEcwV0OpA7dIqhh9O86lJVTWHEvaJnM8Xb5xiMnla8IGkqOJI0ACzq1YEbVnYL1 c0N+KbDPjsx1hY5N4ofRAZI+oc554USN42x3/niNaAIRcXxiDyUceW7h70nSNT0K6hWy Bsi/1ezHmM8DbiI27FToCwBvaDg54JRMriXmjgrgCkEZVc1xPHPY3/lCEKGe4gV9r5Lp bU5w== X-Received: by 10.15.98.68 with SMTP id bi44mr17512560eeb.67.1393134942051; Sat, 22 Feb 2014 21:55:42 -0800 (PST) Received: from [192.168.10.2] ([93.109.195.252]) by mx.google.com with ESMTPSA id u6sm47076628eep.11.2014.02.22.21.55.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Feb 2014 21:55:40 -0800 (PST) Message-ID: <53098D59.1000007@yandex.ru> Date: Sun, 23 Feb 2014 07:55:37 +0200 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#16811: 24.3.50; [ruby-mode] Implicit hash indentation bug References: <87fvnes3qn.fsf@yandex.ru> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16811-done Cc: 16811-done@debbugs.gnu.org, Bozhidar Batsov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 20.02.2014 16:11, Stefan Monnier wrote: >> The problem seems to be that (let (smie--parent) (smie-indent--parent)) > > Which does little more than (smie-backward-sexp 'halfsexp) in this case. Yes. >> called between "=>" and "{" doesn't stop at "=>", but goes straight to >> the parent "{". > > Which seems correct. Maybe according to the current grammar. But not if we want expressions after `=>' to have consistent additional indentation. Which I'm now thinking we probably don't, since otherwise, if it works right, { 'HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, would turn into { 'HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, and that doesn't look good. So indenting the left and right sides of `=>' to the same level is probably the way to go. Changed in revision 116534, fixing this bug. Thanks for the questions! > This said, I don't understand why > > { > 'HashSyntax' => { > 'EnforcedStyle' => 'ruby19', > 'SupportedStyles' => %w(ruby19 hash_rockets) > }, > 'SpaceAroundOperators' => { 'Enabled' => true } > } > > is indented differently from > > {'HashSyntax' => { > 'EnforcedStyle' => 'ruby19', > 'SupportedStyles' => %w(ruby19 hash_rockets) > }, > 'SpaceAroundOperators' => { > 'Enabled' => true }} > > It seems like "it jumps back to { instead of =>" is not the full explanation. That's because we always insert an implicit semicolon after { at eol, and that's because it's hard to distinguish between a curly that's opening a hash and a curly than opens a curly block. And we need those after block-opening curlies, otherwise some token on the first line of the block might consider the curly as its parent, align to it, and block-opening curlies themselves align to the beginning of the statement. So it("is too!") { bar .qux } turns into it("is too!") { bar .qux } ------------=_1393134964-32077-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 19 Feb 2014 17:45:09 +0000 Received: from localhost ([127.0.0.1]:60526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGBCl-0003OE-U5 for submit@debbugs.gnu.org; Wed, 19 Feb 2014 12:45:09 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36770) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGBCg-0003NR-IE for submit@debbugs.gnu.org; Wed, 19 Feb 2014 12:45:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGBCR-0006uA-5k for submit@debbugs.gnu.org; Wed, 19 Feb 2014 12:44:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:40931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGBCR-0006u2-1i for submit@debbugs.gnu.org; Wed, 19 Feb 2014 12:44:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGBCJ-0003q6-Lk for bug-gnu-emacs@gnu.org; Wed, 19 Feb 2014 12:44:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGBCC-0006mS-8v for bug-gnu-emacs@gnu.org; Wed, 19 Feb 2014 12:44:39 -0500 Received: from mail-ea0-f172.google.com ([209.85.215.172]:61993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGBCB-0006kl-Vo for bug-gnu-emacs@gnu.org; Wed, 19 Feb 2014 12:44:32 -0500 Received: by mail-ea0-f172.google.com with SMTP id l9so531043eaj.3 for ; Wed, 19 Feb 2014 09:44:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-type; bh=uSP/IkBNcgJNcxm8v9C9eoSX5H+LCVNQjEv482J6pj4=; b=W3igenLNoggMi3VnmkN2k+3jY24ckyUwT/u0D2xdreYK1zOEIX0k9GsdJzKVPxVVDt /sKAW4fXRK/C3mzIt7rRuDHw4/oAC9DVzgniFazA0G6NKFg4Wf1Nd3jvnkGtDAX25Dks ++PtOp4n/cWn3dh26HaRXjPi+AWtvKJ3ptHDn6zlJoebojv95esQ0uQdSwQqsHxsVWTB U40tdX5+qQ0vcPG0cbNEBnIhoo4blaw+BVuQiDh0HlYZRHHSNwMvtTkKtVZZhgq4FP4t GmaDFXcngyxjoly3izoaISAimXTCa3yPKrqEbuWulhMyH29PGI2OG/bO7fSgIrqBqR68 VpEg== X-Gm-Message-State: ALoCoQlzmERs7mY0oDnru+1V1ioYf33yZr5U+wcTY6SrKwMG98nC06MW6pm6EldbbrJgXrtmUsry X-Received: by 10.15.23.194 with SMTP id h42mr41330924eeu.32.1392831870148; Wed, 19 Feb 2014 09:44:30 -0800 (PST) Received: from Bozhidars-MacBook-Pro.local ([95.87.231.111]) by mx.google.com with ESMTPSA id u6sm3244641eep.11.2014.02.19.09.44.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 19 Feb 2014 09:44:29 -0800 (PST) Received: by Bozhidars-MacBook-Pro.local (Postfix, from userid 501) id A6EE0819A901; Wed, 19 Feb 2014 19:44:25 +0200 (EET) From: Bozhidar Batsov To: bug-gnu-emacs@gnu.org Subject: 24.3.50; [ruby-mode] Implicit hash indentation bug Date: Wed, 19 Feb 2014 19:44:25 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This nested hash literal is indented correctly: { 'HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, 'SpaceAroundOperators' => { 'Enabled' => true } } This one, however, is not: method('HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, 'SpaceAroundOperators' => { 'Enabled' => true }) Should be: method('HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, 'SpaceAroundOperators' => { 'Enabled' => true }) The fact that the hash is implicit (lacking {}) seems to mess with the indentation logic. In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00) of 2014-01-27 on Bozhidars-MacBook-Pro.local Windowing system distributor `Apple', version 10.3.1265 Configured using: `configure --prefix=/usr/local/Cellar/emacs/HEAD --without-dbus --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs/HEAD/share/info/emacs --without-gnutls --with-ns --disable-ns-self-contained' Important settings: locale-coding-system: utf-8-unix Major mode: Ruby Minor modes in effect: ruby-tools-mode: t inf-ruby-minor-mode: t diff-auto-refine-mode: t subword-mode: t guru-mode: t erc-truncate-mode: t erc-spelling-mode: t erc-list-mode: t erc-menu-mode: t erc-autojoin-mode: t erc-ring-mode: t erc-networks-mode: t erc-pcomplete-mode: t erc-track-mode: t erc-match-mode: t erc-button-mode: t erc-fill-mode: t erc-stamp-mode: t erc-netsplit-mode: t erc-irccontrols-mode: t erc-noncommands-mode: t erc-move-to-prompt-mode: t erc-readonly-mode: t global-flycheck-mode: t flycheck-mode: t which-function-mode: t flx-ido-mode: t ido-ubiquitous-mode: t winner-mode: t global-undo-tree-mode: t undo-tree-mode: t whitespace-mode: t global-anzu-mode: t anzu-mode: t projectile-global-mode: t projectile-mode: t flyspell-mode: t volatile-highlights-mode: t global-hl-line-mode: t shell-dirtrack-mode: t recentf-mode: t savehist-mode: t show-smartparens-global-mode: t show-smartparens-mode: t smartparens-mode: t global-auto-revert-mode: t delete-selection-mode: t prelude-global-mode: t prelude-mode: t tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f l M-p C-a M-( g e t - b u f f e r - p r o c e s s SPC C-p C-p C-= M-w C-x b t e s t . r b C-g s-r t e s t . r b C-x b r b C-s C-s C-s C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-SPC C-n C-n C-n C-n C-n C-e C-p C-e C-b M-w C-x b C-y C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-a C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k { C-d SPC C-j C-n C-n C-n C-n C-e } C-x b C-p C-p C-p C-p C-a C-SPC C-n C-n C-n C-n C-e M-w C-x b C-y C-p C-p C-p C-p C-a C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d m e t h o d C-n C-n C-n C-n C-e C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-a M-x r e p o r t Recent messages: Wrote /Users/bozhidar/projects/test.rb Mark set [2 times] Indenting region...done Saving file /Users/bozhidar/projects/test.rb... Wrote /Users/bozhidar/projects/test.rb Mark set [2 times] Indenting region...done Align the elements of a hash literal if they span more than one line. Beginning of buffer Literal { Load-path shadows: /Users/bozhidar/.emacs.d/elpa/tabulated-list-20120406.2251/tabulated-list hides /usr/local/Cellar/emacs/HEAD/share/emacs/24.3.50/lisp/emacs-lisp/tabulated-list Features: (shadow sort emacsbug ielm jka-compr package-build json-fix json rect vc-annotate vc vc-dispatcher hippie-exp yaml-mode ace-jump-mode mail-extr ffap url-parse url-vars css-mode-expansions css-mode scss-mode flymake ruby-tools inf-ruby ruby-mode-expansions smartparens-ruby ruby-mode smie markdown-mode noutline outline mule-util eieio-opt speedbar sb-image ezimage dframe find-dired misearch multi-isearch magit-key-mode magit view epa derived epg epg-config diff-mode git-rebase-mode git-commit-mode server log-edit message sendmail rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log vc-git executable lisp-mnt network-stream starttls tls cider cider-mode cider-repl cider-eldoc clojure-test-mode cider-interaction arc-mode archive-mode cider-client nrepl-client cider-util ewoc superword subword clojure-mode-expansions clojure-mode inf-lisp rainbow-mode color rainbow-delimiters elisp-slime-nav guru-mode prelude-key-chord key-chord prelude-xml nxml-mode-expansions html-mode-expansions sgml-mode smartparens-html rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok prelude-web prelude-scss prelude-scheme prelude-ruby prelude-perl prelude-org prelude-js prelude-erc erc-truncate erc-autoaway erc-spelling erc-notify erc-log erc-list erc-menu erc-join erc-ring erc-networks erc-pcomplete erc-track erc-match erc-button erc-fill erc-stamp erc-netsplit erc-goodies erc erc-backend erc-compat prelude-emacs-lisp prelude-css prelude-common-lisp slime-autoloads prelude-clojure prelude-lisp prelude-c prelude-programming flycheck help-mode rx f which-func imenu prelude-ido smex flx-ido flx ido-ubiquitous warnings ido prelude-osx exec-path-from-shell prelude-global-keybindings prelude-editor winner undo-tree diff esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg eldoc esh-groups eshell esh-module esh-mode esh-util re-builder whitespace browse-kill-ring midnight ediff-merg ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff dired-x dired anzu projectile pkg-info find-func grep compile s bookmark pp expand-region text-mode-expansions er-basic-expansions expand-region-core expand-region-custom flyspell ispell etags volatile-highlights hl-line windmove tramp-cache tramp-sh tramp tramp-compat auth-source gnus-util mm-util mail-prsvr password-cache tramp-loaddefs trampver shell pcomplete comint ansi-color ring format-spec recentf tree-widget wid-edit savehist saveplace diminish smartparens-config smartparens autorevert filenotify delsel prelude-mode easy-mmode edmacro kmacro prelude-core epl advice help-fns dash thingatpt prelude-ui zenburn-theme prelude-packages finder-inf ack-and-a-half-autoloads diminish-autoloads erlang-autoloads flx-ido-autoloads eieio byte-opt bytecomp byte-compile cconv eieio-core grizzl-autoloads key-chord-autoloads logito-autoloads info easymenu cl-macs gv move-text-autoloads pkg-info-autoloads puppet-mode-autoloads rainbow-delimiters-autoloads request-autoloads rubocop-autoloads volatile-highlights-autoloads yaml-mode-autoloads package cl cl-loaddefs cl-lib time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process cocoa ns multi-tty emacs) ------------=_1393134964-32077-1--