unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* tab-width 4 in markdown major mode
@ 2021-04-21 16:55 Frank Hrebabetzky
  2021-04-21 17:53 ` Philip Kaludercic
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Hrebabetzky @ 2021-04-21 16:55 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I have been accepting over the years that TAB hardly ever means "go to 
the next tabulator stop", but is used for something different in nearly 
each major mode. But I am happy with M-i and tab-width 8, which behave 
the same way in any mode I have been using so far.

Now I used the markdown mode for the first time and it behaves as if 
tab-width was 4. I checked the variable value, and it is 8. Can somebody 
tell me how to get this right?
-- 
Frank




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

* Re: tab-width 4 in markdown major mode
  2021-04-21 16:55 tab-width 4 in markdown major mode Frank Hrebabetzky
@ 2021-04-21 17:53 ` Philip Kaludercic
  2021-04-21 20:52   ` Frank Hrebabetzky
  0 siblings, 1 reply; 5+ messages in thread
From: Philip Kaludercic @ 2021-04-21 17:53 UTC (permalink / raw)
  To: Frank Hrebabetzky; +Cc: help-gnu-emacs

Frank Hrebabetzky <hreba@t-online.de> writes:

> Hi,
>
> I have been accepting over the years that TAB hardly ever means "go to
> the next tabulator stop", but is used for something different in
> nearly each major mode. But I am happy with M-i and tab-width 8, which
> behave the same way in any mode I have been using so far.
>
> Now I used the markdown mode for the first time and it behaves as if
> tab-width was 4. I checked the variable value, and it is 8. Can
> somebody tell me how to get this right?

Are you sure, taking a look at the definition of markdown-mode

https://github.com/jrblevin/markdown-mode/blob/master/markdown-mode.el#L9585

it seems to explicitly set the tab-width to 4.

-- 
	Philip K.



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

* Re: tab-width 4 in markdown major mode
  2021-04-21 17:53 ` Philip Kaludercic
@ 2021-04-21 20:52   ` Frank Hrebabetzky
  2021-04-22 13:15     ` Daniel Martín
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Hrebabetzky @ 2021-04-21 20:52 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: help-gnu-emacs

On 21.04.21 19:53, Philip Kaludercic wrote:
> Frank Hrebabetzky <hreba@t-online.de> writes:
> 
>> Hi,
>>
>> I have been accepting over the years that TAB hardly ever means "go to
>> the next tabulator stop", but is used for something different in
>> nearly each major mode. But I am happy with M-i and tab-width 8, which
>> behave the same way in any mode I have been using so far.
>>
>> Now I used the markdown mode for the first time and it behaves as if
>> tab-width was 4. I checked the variable value, and it is 8. Can
>> somebody tell me how to get this right?
> 
> Are you sure, taking a look at the definition of markdown-mode
> 
> https://github.com/jrblevin/markdown-mode/blob/master/markdown-mode.el#L9585
> 
> it seems to explicitly set the tab-width to 4.
> 

Sorry, you are right. What i tried was C-h tab-width, which tells value 
4 and original value 8, and contains a link "customize". This leads to 
the customization window with an entry mask, but the actual value there 
is 8. So I don't know how to set the effective value 4 to 8.

-- 
Frank




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

* Re: tab-width 4 in markdown major mode
  2021-04-21 20:52   ` Frank Hrebabetzky
@ 2021-04-22 13:15     ` Daniel Martín
  2021-04-23  9:16       ` Frank Hrebabetzky
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Martín @ 2021-04-22 13:15 UTC (permalink / raw)
  To: Frank Hrebabetzky; +Cc: Philip Kaludercic, help-gnu-emacs

Frank Hrebabetzky <hreba@t-online.de> writes:

>> Are you sure, taking a look at the definition of markdown-mode
>> https://github.com/jrblevin/markdown-mode/blob/master/markdown-mode.el#L9585
>> it seems to explicitly set the tab-width to 4.
>> 
>
> Sorry, you are right. What i tried was C-h tab-width, which tells
> value 4 and original value 8, and contains a link "customize". This
> leads to the customization window with an entry mask, but the actual
> value there is 8. So I don't know how to set the effective value 4 to
> 8.

tab-width is a buffer-local variable, which means that it can have
different values for different buffers.  As markdown-mode sets it with
setq, it sets the buffer-local value to 4, but the default remains as 8.

If you want to set tab-width to 8 everywhere, you could eval:

(setq-default tab-width 8) ;; This will set the *default* value of tab-width

And then, to override the buffer-local value set by markdown-mode:

(add-hook 'markdown-mode-hook (lambda ()
                        (setq tab-width 8)))

Hope this helps.



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

* Re: tab-width 4 in markdown major mode
  2021-04-22 13:15     ` Daniel Martín
@ 2021-04-23  9:16       ` Frank Hrebabetzky
  0 siblings, 0 replies; 5+ messages in thread
From: Frank Hrebabetzky @ 2021-04-23  9:16 UTC (permalink / raw)
  To: Daniel Martín; +Cc: Philip Kaludercic, help-gnu-emacs

On 22.04.21 15:15, Daniel Martín wrote:
> Frank Hrebabetzky <hreba@t-online.de> writes:
> 
>>> Are you sure, taking a look at the definition of markdown-mode
>>> https://github.com/jrblevin/markdown-mode/blob/master/markdown-mode.el#L9585
>>> it seems to explicitly set the tab-width to 4.
>>>
>>
>> Sorry, you are right. What i tried was C-h tab-width, which tells
>> value 4 and original value 8, and contains a link "customize". This
>> leads to the customization window with an entry mask, but the actual
>> value there is 8. So I don't know how to set the effective value 4 to
>> 8.
> 
> tab-width is a buffer-local variable, which means that it can have
> different values for different buffers.  As markdown-mode sets it with
> setq, it sets the buffer-local value to 4, but the default remains as 8.
> 
> If you want to set tab-width to 8 everywhere, you could eval:
> 
> (setq-default tab-width 8) ;; This will set the *default* value of tab-width
> 
> And then, to override the buffer-local value set by markdown-mode:
> 
> (add-hook 'markdown-mode-hook (lambda ()
>                          (setq tab-width 8)))
> 
> Hope this helps.
> 

Thanks for the hint.
-- 
Frank




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

end of thread, other threads:[~2021-04-23  9:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-21 16:55 tab-width 4 in markdown major mode Frank Hrebabetzky
2021-04-21 17:53 ` Philip Kaludercic
2021-04-21 20:52   ` Frank Hrebabetzky
2021-04-22 13:15     ` Daniel Martín
2021-04-23  9:16       ` Frank Hrebabetzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).