all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* TRAMP and Ruby mode, tabs not being honored
       [not found] <20171115034048.GA24198@rmail>
@ 2017-11-15  5:17 ` Kevin Faulkner
  2017-11-19 10:40   ` Michael Albinus
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Faulkner @ 2017-11-15  5:17 UTC (permalink / raw)
  To: help-gnu-emacs

Hello, I tried to resolve this issue on freenode at #emacs, we made some 
progress but we were not able to reach a resolution in TRAMP mode. 

The problem I have is that over TRAMP mode while editing a chef (Ruby
.rb) file remotely, I enter Ruby mode by nature of editing that file.
When I try make a new block and press <tab> (or just press return from 
the new block) it inserts two spaces. When I am editing previously
written lines/blocks, I can press tab and it will be a tab character. My
company mandates tabs (despite my best efforts to change that) in this
repository. While on IRC I added the hook which seems to work
(suggestion found here: https://stackoverflow.com/a/38901225/9903). It
changed the behavior locally (a tab is a tab), but not over TRAMP, which
is what I'm really looking to achieve. I have made a .dir-locals file
and tried many variations on the options but it generally looks like
this:
```::
(
(setq indent-tabs-mode t)
(ruby-mode . ((indent-tabs-mode . t)
(add-hook 'ruby-mode-hook (lambda ()
(setq indent-tabs-mode t)
(setq tab-width 2)))
(tab-width . 3))))
::```
I know for a fact that the dir-locals file is being read and respected
because I can change the tab-width to be crazy like 10 and it works.
I would prefer not to make a secondary script to change the spaces into
tabs, because I feel this is a configuration/user issue. I can include
my .emacs (init) file, if you like, I don't have anything too extreme
included but here is part of it:
```::
'(bmkp-last-as-first-bookmark-file "/home/kfaulkne/.emacs.d/bookmarks")
'(custom-enabled-themes (quote (misterioso)))
'(enable-remote-dir-locals t)
'(package-selected-packages
(quote
(dired+ elscreen bookmark+ org-notebook async-await magit leanote
	 elpy dokuwiki-mode dokuwiki)))
'(safe-local-variable-values (quote ((ruby-indent-tabs-mode . t))))
;;This was because I kept adding various options I had kept finding.
'(tramp-default-method "sshx"))
::```
Please excuse any inefficiencies, I have I have tried diligently in vain
for a full day and I hope that I might get this resolved. Thank you all
for your time.

-Kevin


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TRAMP and Ruby mode, tabs not being honored
  2017-11-15  5:17 ` TRAMP and Ruby mode, tabs not being honored Kevin Faulkner
@ 2017-11-19 10:40   ` Michael Albinus
       [not found]     ` <20171119235011.GA26859@rmail>
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Albinus @ 2017-11-19 10:40 UTC (permalink / raw)
  To: Kevin Faulkner; +Cc: help-gnu-emacs

Kevin Faulkner <kondor6c@lazytree.us> writes:

Hi Kevin,

> Hello, I tried to resolve this issue on freenode at #emacs, we made some 
> progress but we were not able to reach a resolution in TRAMP mode. 
>
> The problem I have is that over TRAMP mode while editing a chef (Ruby
> .rb) file remotely, I enter Ruby mode by nature of editing that file.
> When I try make a new block and press <tab> (or just press return from 
> the new block) it inserts two spaces. When I am editing previously
> written lines/blocks, I can press tab and it will be a tab character. My
> company mandates tabs (despite my best efforts to change that) in this
> repository. While on IRC I added the hook which seems to work
> (suggestion found here: https://stackoverflow.com/a/38901225/9903). It
> changed the behavior locally (a tab is a tab), but not over TRAMP, which
> is what I'm really looking to achieve. I have made a .dir-locals file
> and tried many variations on the options but it generally looks like
> this:
> ```::
> (
> (setq indent-tabs-mode t)
> (ruby-mode . ((indent-tabs-mode . t)
> (add-hook 'ruby-mode-hook (lambda ()
> (setq indent-tabs-mode t)
> (setq tab-width 2)))
> (tab-width . 3))))
> ::```
> I know for a fact that the dir-locals file is being read and respected
> because I can change the tab-width to be crazy like 10 and it works.
> I would prefer not to make a secondary script to change the spaces into
> tabs, because I feel this is a configuration/user issue. I can include
> my .emacs (init) file, if you like, I don't have anything too extreme
> included but here is part of it:
> ```::
> '(bmkp-last-as-first-bookmark-file "/home/kfaulkne/.emacs.d/bookmarks")
> '(custom-enabled-themes (quote (misterioso)))
> '(enable-remote-dir-locals t)
> '(package-selected-packages
> (quote
> (dired+ elscreen bookmark+ org-notebook async-await magit leanote
> 	 elpy dokuwiki-mode dokuwiki)))
> '(safe-local-variable-values (quote ((ruby-indent-tabs-mode . t))))
> ;;This was because I kept adding various options I had kept finding.
> '(tramp-default-method "sshx"))
> ::```
> Please excuse any inefficiencies, I have I have tried diligently in vain
> for a full day and I hope that I might get this resolved. Thank you all
> for your time.

I have tried to reproduce the problem with the most simple
configuration. I have written a file ~/tmp/foo.el:

--8<---------------cut here---------------start------------->8---
(setq indent-tabs-mode t
      tab-width 3)
(add-hook 'ruby-mode-hook
	  (lambda ()
	    (setq indent-tabs-mode t
		  tab-width 2)))
--8<---------------cut here---------------end--------------->8---

Then I have opened Emacs 27 with a test ruby file, simulating the sshx
method:

$ ~/src/emacs/src/emacs -Q -l ~/tmp/foo.el -l tramp /sshx::~/tmp/estcall.rb

When I edit estcall.rb, and press <RET> after a block, <TAB> is inserted.

Could you, pls, check this recipe in your environment?

> -Kevin

Best regards, Michael.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TRAMP and Ruby mode, tabs not being honored
       [not found]     ` <20171119235011.GA26859@rmail>
@ 2017-11-20  9:15       ` Michael Albinus
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Albinus @ 2017-11-20  9:15 UTC (permalink / raw)
  To: Kevin Faulkner; +Cc: help-gnu-emacs

Kevin Faulkner <kondor6c@lazytree.us> writes:

Hi Kevin,

[pls keep help-gnu-emacs@gnu.org in Cc, for the archives]

>> I have tried to reproduce the problem with the most simple
>> configuration. I have written a file ~/tmp/foo.el:
>> 
>> --8<---------------cut here---------------start------------->8---
>> (setq indent-tabs-mode t
>>       tab-width 3)
>> (add-hook 'ruby-mode-hook
>> 	  (lambda ()
>> 	    (setq indent-tabs-mode t
>> 		  tab-width 2)))
>> --8<---------------cut here---------------end--------------->8---
>> 
>> Then I have opened Emacs 27 with a test ruby file, simulating the sshx
>> method:
>> 
>> $ ~/src/emacs/src/emacs -Q -l ~/tmp/foo.el -l tramp /sshx::~/tmp/estcall.rb
>> 
>> When I edit estcall.rb, and press <RET> after a block, <TAB> is inserted.
>> 
>> Could you, pls, check this recipe in your environment?
>
> Michael, thank you for looking into this, I believe you have fixed my issue
> I tried to load this as you specified, should I keep this loaded in my 
> .dirs-local.el or my local .emacs (init)?

It depends. If you want ruby-mode always use these settings, you could
put the code into your .emacs. Directory local settings are useful for a
kind of "project specific" settings, i.e. if the settings shall be
applied only to files at a given location.

> What was I doing incorrectly?
> I have tried to remove the "-Q", and I still load the file in using -l,
> and I don't think it works, does that mean it could be one of my
> packages that I have installed? I have a few, as i think you can see in
> the configuration post above, but I don't think they are too out of the
> ordinary. Should I consider upgrading?

Using recent package versions might help. If it doesn't, you must bisect
your config. Comment out all loaded packages and half of your .emacs,
start Emacs again. If the problem still exist, it is in the active part
of your .emacs, otherwise it is in the commented part. Continue to
bisect with the non-working part, and so on.

If it isn't your .emacs, then load one package after the other, and
retest.

This way you shall be able to identify the culprit.

> Again, thank you for your time Michael (and others reading this)
>
> -Kevin

Best regards, Michael.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-20  9:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20171115034048.GA24198@rmail>
2017-11-15  5:17 ` TRAMP and Ruby mode, tabs not being honored Kevin Faulkner
2017-11-19 10:40   ` Michael Albinus
     [not found]     ` <20171119235011.GA26859@rmail>
2017-11-20  9:15       ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.