all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* spacing of ls output in emacs shell
@ 2011-03-08 16:43 Strozzi, David J.
  2011-03-08 17:46 ` Valentin Plechinger
  0 siblings, 1 reply; 8+ messages in thread
From: Strozzi, David J. @ 2011-03-08 16:43 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi folks,

I like running shells in emacs (overheard at MIT, regarding OSes: linux is
nice, but I prefer emacs).  I am using emacs 23.2.1, on a linux server,
viewed over X11 on a mac.  I usually use M-x shell, not M-x term (since
the latter does not play well with emacs commands like C-x, M-x).  The
output of ls is not spaced into straight columns.  Well, when I select the
text and paste it into this email, it is (at least on my screen):

> ls
3wave  emacs-23.2  lsp91  papers        tests
Filament eos-dt.i  manuals plasma        tmp
Fis  epws   math  pres        tpd
Gist  estopscat  matlab  profiles_and_gains.i  trapper
Give  fastig   matlab-emacs proposals       vgroup.i
IDLWorkspace71 filelist.txt  matlab7.11 psc        vlasbk
LspJobLog foobar.ps  matlab78 pstopngpdf.sh       workspace
Old  foobar.txt  mpreorg.i reports        xbamp
Take  gausstest.i  mpreorg_drv.i research       ydjs
Zumahydra gv-notes.txt  mydata  resist.i       yorick
barcode.txt h5-yorick-0.8.0  newlip  runint_dndta.i       yorick-cvs
bashrc-ext h5yor-notes.txt  nif  sap        yutils-1.4.0
benisti  hydra   notes_lc seas        yutils-1.5.0
bin  hydrhsp   numerics sigvdt.i       zfunc_test
bookmarks.html juttner   oldlsp  slurm-289901.out      zohar
computers kemp   openmp  spears        zuma
deplete  kil.   oreports squ_rpp
download lib   p4.cfg  srs
ellis  lpildrd   p4.command startup.m
elvis  lsp25   palastro svnrepos


The reason is that there are tabs, and my email client interprets the tabs
as consisting of eight spaces, while in the original emacs window it is
four.

So this gets into the morass of tab spacing.  I have tabs setup, perhaps
not perfectly, but the way I like them for editing files.  So "just make
all tabs all the time do 8 spaces" is not the answer I'd like.

Any advice?  Can I tell emacs "tab = 8 spaces for shells?"  Or tell it not
to use tabs but spaces in shells?


Thanks for your help,
David Strozzi




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

* Re: spacing of ls output in emacs shell
  2011-03-08 16:43 Strozzi, David J.
@ 2011-03-08 17:46 ` Valentin Plechinger
  2011-03-08 18:25   ` Strozzi, David J.
  0 siblings, 1 reply; 8+ messages in thread
From: Valentin Plechinger @ 2011-03-08 17:46 UTC (permalink / raw)
  To: Strozzi, David J.; +Cc: help-gnu-emacs@gnu.org

At Tue, 8 Mar 2011 08:43:26 -0800,
Strozzi, David J. wrote:

> Any advice?  Can I tell emacs "tab = 8 spaces for shells?"  Or tell it not
> to use tabs but spaces in shells?
> Thanks for your help,
> David Strozzi
> 


Have you tried putting something like this in your .emacs?

(setq shell-mode-hook
    (function (lambda ()
                (setq indent-tabs-mode nil))))

Best regards,
Valentin Plechinger







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

* Re: spacing of ls output in emacs shell
       [not found] <mailman.7.1299602618.24943.help-gnu-emacs@gnu.org>
@ 2011-03-08 17:49 ` Uday Reddy
  0 siblings, 0 replies; 8+ messages in thread
From: Uday Reddy @ 2011-03-08 17:49 UTC (permalink / raw)
  To: help-gnu-emacs

Strozzi, David J. wrote:

> So this gets into the morass of tab spacing.  I have tabs setup, perhaps
> not perfectly, but the way I like them for editing files.  So "just make
> all tabs all the time do 8 spaces" is not the answer I'd like.

I hope you have no need to edit other people's files which might have
tab=8sp.  And that other people need to work with your files know that
tab is supposed to mean 4 spaces.  These are perennial problems.

It seems to me that you want to use the 4-space tabs for your own
editing, not for interpreting shell output or other buffers.  Try
putting your customization in mode hooks that you use for editing, while
leaving the global settings alone.

Cheers,
Uday


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

* Re: spacing of ls output in emacs shell
  2011-03-08 17:46 ` Valentin Plechinger
@ 2011-03-08 18:25   ` Strozzi, David J.
  2011-03-08 20:45     ` PJ Weisberg
  2011-03-10  8:19     ` Jonathan Groll
  0 siblings, 2 replies; 8+ messages in thread
From: Strozzi, David J. @ 2011-03-08 18:25 UTC (permalink / raw)
  To: Valentin Plechinger; +Cc: help-gnu-emacs@gnu.org

Hi,

Thanks for the suggestion.  I warn you that I am an emacs "user" and not
"master."  I put these exact lines in my .emacs, restarted, did M-x shell,
ls, same thing - tabs appear in the ls output, and emacs interprets them
as giving about 4 spaces.

Is there something else I need to do to enable this?

I don't understand lisp, so I am not smart enough to think of what I need
to do to adapt this to my environment.

Thanks,
Dave

On 3/8/11 9:46 AM, "Valentin Plechinger" <v.plechinger@gmail.com> wrote:

>At Tue, 8 Mar 2011 08:43:26 -0800,
>Strozzi, David J. wrote:
>
>> Any advice?  Can I tell emacs "tab = 8 spaces for shells?"  Or tell it
>>not
>> to use tabs but spaces in shells?
>> Thanks for your help,
>> David Strozzi
>> 
>
>
>Have you tried putting something like this in your .emacs?
>
>(setq shell-mode-hook
>    (function (lambda ()
>                (setq indent-tabs-mode nil))))
>
>Best regards,
>Valentin Plechinger
>
>
>
>




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

* Re: spacing of ls output in emacs shell
  2011-03-08 18:25   ` Strozzi, David J.
@ 2011-03-08 20:45     ` PJ Weisberg
  2011-03-08 20:54       ` Valentin Plechinger
  2011-03-08 21:06       ` Strozzi, David J.
  2011-03-10  8:19     ` Jonathan Groll
  1 sibling, 2 replies; 8+ messages in thread
From: PJ Weisberg @ 2011-03-08 20:45 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

On Tue, Mar 8, 2011 at 10:25 AM, Strozzi, David J. <strozzi2@llnl.gov> wrote:
> Hi,
>
> Thanks for the suggestion.  I warn you that I am an emacs "user" and not
> "master."  I put these exact lines in my .emacs, restarted, did M-x shell,
> ls, same thing - tabs appear in the ls output, and emacs interprets them
> as giving about 4 spaces.
>
> Is there something else I need to do to enable this?
>
> I don't understand lisp, so I am not smart enough to think of what I need
> to do to adapt this to my environment.

My suggestion would be to put

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

in your .emacs instead of the code Valentin suggested.  (I would test
it, but 'ls' doesn't output any tabs in shell mode when I try it.)

-PJ



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

* Re: spacing of ls output in emacs shell
  2011-03-08 20:45     ` PJ Weisberg
@ 2011-03-08 20:54       ` Valentin Plechinger
  2011-03-08 21:06       ` Strozzi, David J.
  1 sibling, 0 replies; 8+ messages in thread
From: Valentin Plechinger @ 2011-03-08 20:54 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

At Tue, 8 Mar 2011 12:45:14 -0800,
PJ Weisberg wrote:
> 
> On Tue, Mar 8, 2011 at 10:25 AM, Strozzi, David J. <strozzi2@llnl.gov> wrote:
> > Hi,
> >
> > Thanks for the suggestion.  I warn you that I am an emacs "user" and not
> > "master."  I put these exact lines in my .emacs, restarted, did M-x shell,
> > ls, same thing - tabs appear in the ls output, and emacs interprets them
> > as giving about 4 spaces.
> >
> > Is there something else I need to do to enable this?
> >
> > I don't understand lisp, so I am not smart enough to think of what I need
> > to do to adapt this to my environment.
> 
> My suggestion would be to put
> 
> (add-hook 'shell-mode-hook (lambda()
>                              (setq tab-width 8)))
> 
> in your .emacs instead of the code Valentin suggested.  (I would test
> it, but 'ls' doesn't output any tabs in shell mode when I try it.)
> 
> -PJ

Ah yes, I forgot about the 8 spaces, that should work better (or try both together).
I tried both and it works fine for me (but I never had this problem in the first place).

Besides that, is the problem only in this case or whenever you copy things from emacs?

Best Regards
Valentin Plechinger



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

* Re: spacing of ls output in emacs shell
  2011-03-08 20:45     ` PJ Weisberg
  2011-03-08 20:54       ` Valentin Plechinger
@ 2011-03-08 21:06       ` Strozzi, David J.
  1 sibling, 0 replies; 8+ messages in thread
From: Strozzi, David J. @ 2011-03-08 21:06 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi,

Thanks to all for your suggestions.  The upshot is the below solution
seems to still give tabs, but they are displayed as 8-space widths
regardless of the global value of tab-width.  To truly test this, make
sure you ls in a dir that has wide enough filenames that more than 8
spaces are needed between a short name in col. N and col. N+1.

Anyway, I have enough different ways to make ls behave nice that I am
happy.

I generally hate having actual tabs in text files, and try to always have
them expanded as spaces.  Precisely because sharing them among people or
editors wreaks havoc.  12 years ago I got Fortran 77 source with tabs, and
on Windoze a line got rendered as:

   ... x*cos(t)

where the * got pushed to column 73.  So, *cos(t) gets chopped off.  No
compiler error.  AND no numerical error at t=0.

No, I didn't stay up all night thinking up this corner case.  I
encountered it in the wild.  After one day and many curses, I learned to
hate tabs...

Dave

On 3/8/11 12:45 PM, "PJ Weisberg" <pj@irregularexpressions.net> wrote:

>On Tue, Mar 8, 2011 at 10:25 AM, Strozzi, David J. <strozzi2@llnl.gov>
>wrote:
>> Hi,
>>
>> Thanks for the suggestion.  I warn you that I am an emacs "user" and not
>> "master."  I put these exact lines in my .emacs, restarted, did M-x
>>shell,
>> ls, same thing - tabs appear in the ls output, and emacs interprets them
>> as giving about 4 spaces.
>>
>> Is there something else I need to do to enable this?
>>
>> I don't understand lisp, so I am not smart enough to think of what I
>>need
>> to do to adapt this to my environment.
>
>My suggestion would be to put
>
>(add-hook 'shell-mode-hook (lambda()
>                             (setq tab-width 8)))
>
>in your .emacs instead of the code Valentin suggested.  (I would test
>it, but 'ls' doesn't output any tabs in shell mode when I try it.)
>
>-PJ
>




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

* Re: spacing of ls output in emacs shell
  2011-03-08 18:25   ` Strozzi, David J.
  2011-03-08 20:45     ` PJ Weisberg
@ 2011-03-10  8:19     ` Jonathan Groll
  1 sibling, 0 replies; 8+ messages in thread
From: Jonathan Groll @ 2011-03-10  8:19 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 8 Mar 2011 10:25:56 -0800, "Strozzi, David J." <strozzi2@llnl.gov> wrote:

> Hi,
> 
> Thanks for the suggestion.  I warn you that I am an emacs "user" and not
> "master."  I put these exact lines in my .emacs, restarted, did M-x shell,
> ls, same thing - tabs appear in the ls output, and emacs interprets them
> as giving about 4 spaces.
> 
> Is there something else I need to do to enable this?
> 
> I don't understand lisp, so I am not smart enough to think of what I need
> to do to adapt this to my environment.

Tabs vs spaces, some reading on the problem:
http://cscs.umich.edu/~rlr/Misc/emacs_tabs.htm 

Tabs versus Spaces: An Eternal Holy War:
http://www.jwz.org/doc/tabs-vs-spaces.html

Cheers,
Jonathan
--
jjg: Jonathan J. Groll : groll co za
has_one { :blog => "http://bloggroll.com" }
Sent from my computer device which runs on free software



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

end of thread, other threads:[~2011-03-10  8:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.7.1299602618.24943.help-gnu-emacs@gnu.org>
2011-03-08 17:49 ` spacing of ls output in emacs shell Uday Reddy
2011-03-08 16:43 Strozzi, David J.
2011-03-08 17:46 ` Valentin Plechinger
2011-03-08 18:25   ` Strozzi, David J.
2011-03-08 20:45     ` PJ Weisberg
2011-03-08 20:54       ` Valentin Plechinger
2011-03-08 21:06       ` Strozzi, David J.
2011-03-10  8:19     ` Jonathan Groll

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.