emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* whitespace in org source files
@ 2021-11-12 22:35 excalamus--- via General discussions about Org-mode.
  2021-11-13  2:15 ` Tim Cross
  2021-11-13 12:57 ` Juan Manuel Macías
  0 siblings, 2 replies; 3+ messages in thread
From: excalamus--- via General discussions about Org-mode. @ 2021-11-12 22:35 UTC (permalink / raw)
  To: emacs-orgmode


I'm hacking on ob-shell.el and I see that the source has mixed tabs and spaces. If I were to contribute changes, would it be an issue if tabs were converted to whitespace?

I've not used the email contribution style before and have had whitespace issues in the past with GitHub PRs.   I typically run whitespace-cleanup with the before-save-hook which changes tabs to spaces.


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

* Re: whitespace in org source files
  2021-11-12 22:35 whitespace in org source files excalamus--- via General discussions about Org-mode.
@ 2021-11-13  2:15 ` Tim Cross
  2021-11-13 12:57 ` Juan Manuel Macías
  1 sibling, 0 replies; 3+ messages in thread
From: Tim Cross @ 2021-11-13  2:15 UTC (permalink / raw)
  To: emacs-orgmode


excalamus--- via "General discussions about Org-mode." <emacs-orgmode@gnu.org> writes:

> I'm hacking on ob-shell.el and I see that the source has mixed tabs and spaces.
> If I were to contribute changes, would it be an issue if tabs were converted to
> whitespace?
>
> I've not used the email contribution style before and have had whitespace issues
> in the past with GitHub PRs.  I typically run whitespace-cleanup with the
> before-save-hook which changes tabs to spaces.

It is usually a bad idea to change whitespace in this manner. It will
not improve readibility but will cause lots of change which will likely
make merging and tracking/reviewing changes harder than necessary.

Ideally, git itslef would be configured to deal with this automatically.
Unfortunately, the tab v space arguments can often reach the level of
religious war and represents something which is difficult to get
consensus on.

My recommendation would be to use dir local variable settings to make
Emacs use the same formatting style (i.e. with tabs) for working with
org-mode sources if your normal/wider preference is just for spaces.
this will prevent Emacs from making unnecessary whitespace changes.


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

* Re: whitespace in org source files
  2021-11-12 22:35 whitespace in org source files excalamus--- via General discussions about Org-mode.
  2021-11-13  2:15 ` Tim Cross
@ 2021-11-13 12:57 ` Juan Manuel Macías
  1 sibling, 0 replies; 3+ messages in thread
From: Juan Manuel Macías @ 2021-11-13 12:57 UTC (permalink / raw)
  To: excalamus; +Cc: Tim Cross, orgmode

Hi,

excalamus--- via "General discussions about Org-mode." writes:

> I've not used the email contribution style before and have had
> whitespace issues in the past with GitHub PRs.  I typically run
> whitespace-cleanup with the before-save-hook which changes tabs to
> spaces.

I agree with Tim that running whitespace-cleanup is usually a bad idea
within a Git repository. I also have, like you, whitespace-cleanup
hooked to before-save-hook, like a relic of my first Emacs setups. In
case it helps, I have added to my init this function:

(defun my-whitespace-cleanup-no-git ()
    (let ((buf (buffer-file-name)))
      (when (not (vc-git-responsible-p buf))
	(whitespace-cleanup))))

and then:

(add-hook 'before-save-hook 'my-whitespace-cleanup-no-git)

Best regards,

Juan Manuel 


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

end of thread, other threads:[~2021-11-13 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 22:35 whitespace in org source files excalamus--- via General discussions about Org-mode.
2021-11-13  2:15 ` Tim Cross
2021-11-13 12:57 ` Juan Manuel Macías

Code repositories for project(s) associated with this inbox:

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

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).