all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Several beginner-questions
@ 2011-07-23  7:13 Marko Vojinovic
  0 siblings, 0 replies; 15+ messages in thread
From: Marko Vojinovic @ 2011-07-23  7:13 UTC (permalink / raw)
  To: help-gnu-emacs


Hello everyone! :-)

I am a new member on this list, sorry if I break any posting guidelines.

After some number of years (cca 20) of using various editors under various 
OSes, I decided to go pro and migrate to emacs. The main point being that 
emacs seems to be the only editor configurable enough for my taste. The role-
model editor from my youth was the CygnusEditor for the Amiga back in the day, 
so my idea was/is to recreate some (but not all) aspects of that environment 
that I particularly like.

Anyway, I devoted some time and googling to learn some basics about emacs and 
customize my ~/.emacs to some point. For various reasons, I always start emacs 
in an xterm with the -nw switch (or in a text console if there is no X 
around), and never ever use the X version. Therefore the questions I have 
relate exclusively to that environment.

The main questions that google failed to answer for me are the following:

1) Is there a package to recreate the old MS-DOS pull-down menu display, 
instead of the default "open new buffer to display menu items" behavior 
(invoked by F10)? I have found the dropdown-list.el, but it seems it was 
written for the X version and does not work for emacs -nw. Or I don't know how 
to use it properly.

2) I have set (line-number-mode 1) and (column-number-mode 1) in order to see 
the cursor coordinates, and this works. However, column numbering begins with 
zero --- the top-left corner of the buffer has coordinates (1,0). How do I get 
rid of the 0-th column? I want the columns to be counted from 1 (so that the 
corner has coordinates (1,1), which is more natural from my POV)?

3) When I do a M-x list-colors-display, emacs displays all 256 colors 
properly, but with wrong names. Instead of giving the colors names as per the 
rgb.txt file, it lists names like color-16, color-17, etc. Those names are not 
recognized in the .emacs (while rgb.txt names are). How do I make it use color 
names from the rgb.txt file, when invoking list-colors-display? I want to 
customize my syntax-highlighting, and this is somewhat hard if I have to guess 
the names of the colors displayed by that function.

4) I'd like to use the TAB key to type four SPC characters in the buffer when I 
press it. However, I don't want to disturb its auto-completion functionality 
when doing anything other than just typing text in the buffer. What is the 
"safest" way to create a keybinding for this?

5) My main use-case is typesetting LaTeX documents, so I have installed the 
auctex package, and it seems to work well. However, I have just begun to 
explore its capabilities, and would appreciate any advice on what to pay 
attention and what are its most useful features. For example, is there a 
label-autocomplete feature for easy filling in \ref{} and \cite{} commands?

I hope these questions are not too stupid. I have been using emacs for only a 
week now, so sorry for my ignorance.

Also, if important, my environment is:

[vmarko@Yoda ~]$ emacs -nw --version
GNU Emacs 23.2.1
[vmarko@Yoda ~]$ cat /etc/redhat-release 
Fedora release 14 (Laughlin)
[vmarko@Yoda ~]$ uname -a
Linux Yoda 2.6.35.13-92.fc14.x86_64 #1 SMP Sat May 21 17:26:25 UTC 2011 x86_64 
x86_64 x86_64 GNU/Linux

TIA, :-)
Marko




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

* Several beginner-questions
@ 2011-07-24 22:22 Marko Vojinovic
  2011-07-25 15:06 ` suvayu ali
  2011-07-25 15:14 ` Eli Zaretskii
  0 siblings, 2 replies; 15+ messages in thread
From: Marko Vojinovic @ 2011-07-24 22:22 UTC (permalink / raw)
  To: help-gnu-emacs


Hello everyone! :-)

I am a new member on this list, sorry if I break any posting guidelines.

After some number of years (cca 20) of using various editors under various 
OSes, I decided to go pro and migrate to emacs. The main point being that 
emacs seems to be the only editor configurable enough for my taste. The role-
model editor from my youth was the CygnusEditor for the Amiga back in the day, 
so my idea was/is to recreate some (but not all) aspects of that environment 
that I particularly like.

Anyway, I devoted some time and googling to learn some basics about emacs and 
customize my ~/.emacs to some point. For various reasons, I always start emacs 
in an xterm with the -nw switch (or in a text console if there is no X 
around), and never ever use the X version. Therefore the questions I have 
relate exclusively to that environment.

The main questions that google failed to answer for me are the following:

1) Is there a package to recreate the old MS-DOS pull-down menu display, 
instead of the default "open new buffer to display menu items" behavior 
(invoked by F10)? I have found the dropdown-list.el, but it seems it was 
written for the X version and does not work for emacs -nw. Or I don't know how 
to use it properly.

2) I have set (line-number-mode 1) and (column-number-mode 1) in order to see 
the cursor coordinates, and this works. However, column numbering begins with 
zero --- the top-left corner of the buffer has coordinates (1,0). How do I get 
rid of the 0-th column? I want the columns to be counted from 1 (so that the 
corner has coordinates (1,1), which is more natural from my POV)?

3) When I do a M-x list-colors-display, emacs displays all 256 colors 
properly, but with wrong names. Instead of giving the colors names as per the 
rgb.txt file, it lists names like color-16, color-17, etc. Those names are not 
recognized in the .emacs (while rgb.txt names are). How do I make it use color 
names from the rgb.txt file, when invoking list-colors-display? I want to 
customize my syntax-highlighting, and this is somewhat hard if I have to guess 
the names of the colors displayed by that function.

4) I'd like to use the TAB key to type four SPC characters in the buffer when I 
press it. However, I don't want to disturb its auto-completion functionality 
when doing anything other than just typing text in the buffer. What is the 
"safest" way to create a keybinding for this?

5) My main use-case is typesetting LaTeX documents, so I have installed the 
auctex package, and it seems to work well. However, I have just begun to 
explore its capabilities, and would appreciate any advice on what to pay 
attention and what are its most useful features. For example, is there a 
label-autocomplete feature for easy filling in \ref{} and \cite{} commands?

I hope these questions are not too stupid. I have been using emacs for only a 
week now, so sorry for my ignorance.

Also, if important, my environment is:

[vmarko@Yoda ~]$ emacs -nw --version
GNU Emacs 23.2.1
[vmarko@Yoda ~]$ cat /etc/redhat-release 
Fedora release 14 (Laughlin)
[vmarko@Yoda ~]$ uname -a
Linux Yoda 2.6.35.13-92.fc14.x86_64 #1 SMP Sat May 21 17:26:25 UTC 2011 x86_64 
x86_64 x86_64 GNU/Linux

TIA, :-)
Marko




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

* Re: Several beginner-questions
  2011-07-24 22:22 Several beginner-questions Marko Vojinovic
@ 2011-07-25 15:06 ` suvayu ali
  2011-07-27  1:05   ` Marko Vojinovic
  2011-07-25 15:14 ` Eli Zaretskii
  1 sibling, 1 reply; 15+ messages in thread
From: suvayu ali @ 2011-07-25 15:06 UTC (permalink / raw)
  To: vmarko; +Cc: help-gnu-emacs

Hey Marko,

Nice to see you here too. :)

On Mon, Jul 25, 2011 at 12:22 AM, Marko Vojinovic <vvmarko@gmail.com> wrote:
> 5) My main use-case is typesetting LaTeX documents, so I have installed the
> auctex package, and it seems to work well. However, I have just begun to
> explore its capabilities, and would appreciate any advice on what to pay
> attention and what are its most useful features. For example, is there a
> label-autocomplete feature for easy filling in \ref{} and \cite{} commands?
>

I would recommend you try reftex-mode with auctex. You mention you use
Emacs mostly without X, but I would like to encourage you to use it
with the gui to take advantage of all the wonderful features of auctex
mode (e.g. in buffer previews).

I hope this helps. :)

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: Several beginner-questions
  2011-07-24 22:22 Several beginner-questions Marko Vojinovic
  2011-07-25 15:06 ` suvayu ali
@ 2011-07-25 15:14 ` Eli Zaretskii
  2011-07-27  2:57   ` Marko Vojinovic
  1 sibling, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2011-07-25 15:14 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Marko Vojinovic <vvmarko@gmail.com>
> Date: Sun, 24 Jul 2011 23:22:31 +0100
> 
> 1) Is there a package to recreate the old MS-DOS pull-down menu display, 
> instead of the default "open new buffer to display menu items" behavior 
> (invoked by F10)?

I don't think so.  Someone(TM) should back-port the DOS code that
supports menus of a text-only terminal to the rest of Emacs platforms.

> 2) I have set (line-number-mode 1) and (column-number-mode 1) in order to see 
> the cursor coordinates, and this works. However, column numbering begins with 
> zero --- the top-left corner of the buffer has coordinates (1,0). How do I get 
> rid of the 0-th column? I want the columns to be counted from 1 (so that the 
> corner has coordinates (1,1), which is more natural from my POV)?

You could redefine mode-line-format to do that, but it will need a bit
of Lisp programming.

> 3) When I do a M-x list-colors-display, emacs displays all 256 colors 
> properly, but with wrong names. Instead of giving the colors names as per the 
> rgb.txt file, it lists names like color-16, color-17, etc. Those names are not 
> recognized in the .emacs (while rgb.txt names are). How do I make it use color 
> names from the rgb.txt file, when invoking list-colors-display?

See tty-colors.el for the infrastructure and term/xterm.el for an
example of using it.  Actually, since you seem to be using a 256-color
xterm, Emacs should have done this automatically for you.  Perhaps you
have an old version of Emacs, in which case upgrade.

> 4) I'd like to use the TAB key to type four SPC characters in the buffer when I 
> press it. However, I don't want to disturb its auto-completion functionality 
> when doing anything other than just typing text in the buffer. What is the 
> "safest" way to create a keybinding for this?

See indent-tabs-mode and tab-width.

> [vmarko@Yoda ~]$ emacs -nw --version
> GNU Emacs 23.2.1

Suggest to upgrade to Emacs 23.3, the latest official release.



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

* Re: Several beginner-questions
  2011-07-25 15:06 ` suvayu ali
@ 2011-07-27  1:05   ` Marko Vojinovic
  2011-07-27  1:36     ` suvayu ali
  2011-08-15  0:39     ` Ken Goldman
  0 siblings, 2 replies; 15+ messages in thread
From: Marko Vojinovic @ 2011-07-27  1:05 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday 25 July 2011 16:06:50 suvayu ali wrote:
> Hey Marko,
> 
> Nice to see you here too. :)

Thanks, nice to be here! ;-)

> I would recommend you try reftex-mode with auctex. You mention you use
> Emacs mostly without X, but I would like to encourage you to use it
> with the gui to take advantage of all the wonderful features of auctex
> mode (e.g. in buffer previews).

Oh yes, I tried it, and it looks rather cool. The problem is, however, that I 
work quite often from a remote machine, via ssh, and without X. So I believe 
that in my case it is a good idea to develop habits for using Emacs without 
the gui, from ground up.

If I got to the point of making some effort to learn and use a powerful text 
editor, I might as well learn it in a way that is platform/gui/os-independent. 
It should be a good investment of time.

Besides, TeX buffer previews notwithstanding, Emacs' gui is just soooo ugly... 
Just my personal taste here. ;-)

Anyway, thanks for the info! :-)
Marko




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

* Re: Several beginner-questions
  2011-07-27  1:05   ` Marko Vojinovic
@ 2011-07-27  1:36     ` suvayu ali
  2011-08-15  0:36       ` Ken Goldman
  2011-08-15  0:39     ` Ken Goldman
  1 sibling, 1 reply; 15+ messages in thread
From: suvayu ali @ 2011-07-27  1:36 UTC (permalink / raw)
  To: vmarko; +Cc: help-gnu-emacs

Hey Marko,

On Wed, Jul 27, 2011 at 3:05 AM, Marko Vojinovic <vvmarko@gmail.com> wrote:
> Oh yes, I tried it, and it looks rather cool. The problem is, however, that I
> work quite often from a remote machine, via ssh, and without X. So I believe
> that in my case it is a good idea to develop habits for using Emacs without
> the gui, from ground up.
>

Emacs has a solution for everything! Try the amazing tramp package to
edit remote files (although I am not sure whether auctex is "tramp
aware"). `C-h i m TRAMP RET' That said, as far as I know reftex-mode
works just fine on a terminal. You will only miss out on the latex
previews in auctex.

>
> Besides, TeX buffer previews notwithstanding, Emacs' gui is just soooo ugly...
> Just my personal taste here. ;-)
>

Well I can't argue with that. I turn off all the bells and whistles
(icons, buttons, scroll bars ...) anyway. :-)

> Anyway, thanks for the info! :-)
> Marko

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: Several beginner-questions
  2011-07-25 15:14 ` Eli Zaretskii
@ 2011-07-27  2:57   ` Marko Vojinovic
  2011-07-27  5:40     ` Eli Zaretskii
  2011-07-27  6:48     ` Teemu Likonen
  0 siblings, 2 replies; 15+ messages in thread
From: Marko Vojinovic @ 2011-07-27  2:57 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday 25 July 2011 16:14:58 Eli Zaretskii wrote:
> > From: Marko Vojinovic <vvmarko@gmail.com>
> > Date: Sun, 24 Jul 2011 23:22:31 +0100
> > 
> > 1) Is there a package to recreate the old MS-DOS pull-down menu display,
> > instead of the default "open new buffer to display menu items" behavior
> > (invoked by F10)?
> 
> I don't think so.  Someone(TM) should back-port the DOS code that
> supports menus of a text-only terminal to the rest of Emacs platforms.

I guess I wasn't clear enough. I have never used Emacs under DOS, and I am not 
saying that there is any existing code to be backported. But I did use other 
text editors under DOS (the rudimentary "Edit" editor comes to mind), and most 
of them had the pull-down menus drawn in ascii-art using various "graphics" 
characters (greater-than-128 codes of ascii of the bios-provided font).

I was wondering if something of similar look-and-feel ever existed for Emacs. 
So this has nothing to do with backporting any DOS code, my guess is that this 
should be created from scratch. I just thought that someone already did it, 
since I guess it is (or should be) a common thing to have pull-down menus, 
even in a text-only terminal. :-)

> > 2) I have set (line-number-mode 1) and (column-number-mode 1) in order to
> > see the cursor coordinates, and this works. However, column numbering
> > begins with zero --- the top-left corner of the buffer has coordinates
> > (1,0). How do I get rid of the 0-th column? I want the columns to be
> > counted from 1 (so that the corner has coordinates (1,1), which is more
> > natural from my POV)?
> 
> You could redefine mode-line-format to do that, but it will need a bit
> of Lisp programming.

Oh, ok. I guess I'll just have to add one column in my head every time I need 
to know where the point is...

But *why* (for heaven's sake) does it count columns from zero? I've never ever 
seen any other text editor do that. Even the KMail composer that I'm typing 
into right now counts the first column as "column 1"... I'm a bit dissapointed 
that such a weird default counting was chosen, and in addition that it takes a 
lisp expert to customize it. What was the thinking behind the 0-th column?

> > 3) When I do a M-x list-colors-display, emacs displays all 256 colors
> > properly, but with wrong names. Instead of giving the colors names as per
> > the rgb.txt file, it lists names like color-16, color-17, etc. Those
> > names are not recognized in the .emacs (while rgb.txt names are). How do
> > I make it use color names from the rgb.txt file, when invoking
> > list-colors-display?
> 
> See tty-colors.el for the infrastructure and term/xterm.el for an
> example of using it.  Actually, since you seem to be using a 256-color
> xterm, Emacs should have done this automatically for you.  Perhaps you
> have an old version of Emacs, in which case upgrade.

Umm, I don't seem to understand how to use the tty-colors package. In order to 
try it out, I opened it, did M-x eval-buffer, and after that the
M-x list-colors-display still displays the colors with names color-16, 
color-17, etc, just in different order than before. There is no mention of the 
usual human-readable names for colors. What do I need to do to have the names 
appear in the colors that correspond to them?

I'd appreciate some hand-holding here, I'm fairly new to Emacs, and Lisp is 
also somewhat a mistery for me (although I am familiar with the concepts of 
functional programming in general).

> > 4) I'd like to use the TAB key to type four SPC characters in the buffer
> > when I press it. However, I don't want to disturb its auto-completion
> > functionality when doing anything other than just typing text in the
> > buffer. What is the "safest" way to create a keybinding for this?
> 
> See indent-tabs-mode and tab-width.

Ok, I have RTFM for those variables (and hopefully understood it), set

(setq-default indent-tabs-mode nil) 
(setq-default tab-width 4)

in the .emacs, restarted Emacs, and when I press the TAB key in the buffer, 
nothing happens. The cursor doesn't move, it completely ignores the TAB key. 
What I want is the cursor to type four spaces instead of me doing it manually. 
What am I doing wrong?

Btw, the TAB key works perfectly for the auto-completion in the minibuffer, it 
just does nothing in the text buffer.
 
> > [vmarko@Yoda ~]$ emacs -nw --version
> > GNU Emacs 23.2.1
> 
> Suggest to upgrade to Emacs 23.3, the latest official release.

 :-) And here I am using Fedora because it's providing me with "leading edge" 
software... ;-) But I wouldn't like to go away from the distro-provided 
version if I don't really have to. I don't think that my questions above are 
obsolete just because I use 23.2.1 instead of 23.3.

Thanks for help! :-)
Marko






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

* Re: Several beginner-questions
  2011-07-27  2:57   ` Marko Vojinovic
@ 2011-07-27  5:40     ` Eli Zaretskii
  2011-07-28 22:07       ` Marko Vojinovic
  2011-07-27  6:48     ` Teemu Likonen
  1 sibling, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2011-07-27  5:40 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Marko Vojinovic <vvmarko@gmail.com>
> Date: Wed, 27 Jul 2011 03:57:05 +0100
> 
> > I don't think so.  Someone(TM) should back-port the DOS code that
> > supports menus of a text-only terminal to the rest of Emacs platforms.
> 
> I guess I wasn't clear enough. I have never used Emacs under DOS, and I am not 
> saying that there is any existing code to be backported. But I did use other 
> text editors under DOS (the rudimentary "Edit" editor comes to mind), and most 
> of them had the pull-down menus drawn in ascii-art using various "graphics" 
> characters (greater-than-128 codes of ascii of the bios-provided font).

Emacs does as well, but only in its DOS build.  I was saying that
someone should take that code and implement it for the Unix TTY.

> So this has nothing to do with backporting any DOS code, my guess is that this 
> should be created from scratch.

Since it is already implemented for one platform supported by Emacs,
doing it again from scratch would be a waste of resources.

In any case, this job still awaits a motivated volunteer.

> since I guess it is (or should be) a common thing to have pull-down menus, 
> even in a text-only terminal. :-)

Guess what? most veteran Emacs users, including the maintainers, don't
use menus too much.  Which could be part of the reason why TTYs lack
real menus.

> But *why* (for heaven's sake) does it count columns from zero?

I don't know.  Tradition, I guess, lifted from some ancient editor
which was popular back when Emacs was invented.

> I've never ever 
> seen any other text editor do that. Even the KMail composer that I'm typing 
> into right now counts the first column as "column 1"... I'm a bit dissapointed 
> that such a weird default counting was chosen

Most of the software you see today copycats Microsoft Windows GUI
style, so it's no surprise they all look similar and different from
Emacs.  Emacs predates all of them.  So if you want to talk about
weird defaults, it's those other programs that are "weird" ;-)

> > See tty-colors.el for the infrastructure and term/xterm.el for an
> > example of using it.  Actually, since you seem to be using a 256-color
> > xterm, Emacs should have done this automatically for you.  Perhaps you
> > have an old version of Emacs, in which case upgrade.
> 
> Umm, I don't seem to understand how to use the tty-colors package. In order to 
> try it out, I opened it, did M-x eval-buffer, and after that the
> M-x list-colors-display still displays the colors with names color-16, 
> color-17, etc, just in different order than before. There is no mention of the 
> usual human-readable names for colors. What do I need to do to have the names 
> appear in the colors that correspond to them?
> 
> I'd appreciate some hand-holding here

Take a look at tty-color-define, this is the function you want to
use.  And please be sure to look more carefully the commentary and the
code of the packages you are pointed to: they have all this
information spelled out.  For example, term/xterm.el includes a
function names xterm-register-default-colors, which shows how to
associate color names with colors supported by the xterm.  You should
do something similar, but with color names you want to use.

> > See indent-tabs-mode and tab-width.
> 
> Ok, I have RTFM for those variables (and hopefully understood it), set
> 
> (setq-default indent-tabs-mode nil) 
> (setq-default tab-width 4)
> 
> in the .emacs, restarted Emacs, and when I press the TAB key in the buffer, 
> nothing happens.

What is your value of tab-always-indent?



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

* Re: Several beginner-questions
  2011-07-27  2:57   ` Marko Vojinovic
  2011-07-27  5:40     ` Eli Zaretskii
@ 2011-07-27  6:48     ` Teemu Likonen
  2011-07-27 13:57       ` Drew Adams
  1 sibling, 1 reply; 15+ messages in thread
From: Teemu Likonen @ 2011-07-27  6:48 UTC (permalink / raw)
  To: vmarko; +Cc: help-gnu-emacs

* 2011-07-27T03:57:05+01:00 * Marko Vojinovic wrote:

> [...] I'm fairly new to Emacs, and Lisp is also somewhat a mistery for
> me (although I am familiar with the concepts of functional programming
> in general).

Emacs Lisp, and other popular Lisps as well, are multi-paradigm
languages. They support many paradigms but do not force any of them. For
example, imperative and functional programming is supported. It's a
common myth that Lisps are (purely) functional languages. They are not.

In my experience the first big difference for a Lisp newbie is that
there are no separate statements and expressions; there are only
expressions. Another thing to realize is that Lisp code is actually Lisp
data (trees of cons cells).



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

* RE: Several beginner-questions
  2011-07-27  6:48     ` Teemu Likonen
@ 2011-07-27 13:57       ` Drew Adams
  0 siblings, 0 replies; 15+ messages in thread
From: Drew Adams @ 2011-07-27 13:57 UTC (permalink / raw)
  To: 'Teemu Likonen', vmarko; +Cc: help-gnu-emacs

> > [...] I'm fairly new to Emacs, and Lisp is also somewhat a 
> > mistery for me (although I am familiar with the concepts
> > of functional programming in general).
> 
> Emacs Lisp, and other popular Lisps as well, are multi-paradigm
> languages. They support many paradigms but do not force any 
> of them. For example, imperative and functional programming is
> supported. It's a common myth that Lisps are (purely) functional
> languages. They are not.
> 
> In my experience the first big difference for a Lisp newbie is that
> there are no separate statements and expressions; there are only
> expressions. Another thing to realize is that Lisp code is 
> actually Lisp data (trees of cons cells).

Just to add a little to what Teemu noted (which is correct):

1. Learn about Lisp symbols and conses (list structure). If you understand those
two you'll get through 80% of the learning gotchas. And no, don't suppose that
you understand Lisp conses because you understand lists in Haskell or Prolog.
And yes, there is more to symbols than meets the eye.

2. You're better off forgetting altogether about Lisp being a functional
language. In the modern (since the 1970s) sense, a functional language is
typically pure (no side effects, referentially transparent), typically lazy, and
typically cleanly higher order. Lisp is not lambda calculus.

Lisp (including Scheme) is imperative through and through, regardless of what
anyone might say about being able to program functionally using a subset of it.

Lisp is to a functional language what Mock Lisp was to Lisp: it might look like
it, and it might occasionally quack like it, but it's not the same duck at all.




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

* Re: Several beginner-questions
  2011-07-27  5:40     ` Eli Zaretskii
@ 2011-07-28 22:07       ` Marko Vojinovic
  2011-07-29  6:08         ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Marko Vojinovic @ 2011-07-28 22:07 UTC (permalink / raw)
  To: help-gnu-emacs

On Wednesday 27 July 2011 06:40:30 Eli Zaretskii wrote:
> > From: Marko Vojinovic <vvmarko@gmail.com>
> > Date: Wed, 27 Jul 2011 03:57:05 +0100
> > 
> > I guess I wasn't clear enough. I have never used Emacs under DOS, and I
> > am not saying that there is any existing code to be backported. But I
> > did use other text editors under DOS (the rudimentary "Edit" editor
> > comes to mind), and most of them had the pull-down menus drawn in
> > ascii-art using various "graphics" characters (greater-than-128 codes of
> > ascii of the bios-provided font).
> 
> Emacs does as well, but only in its DOS build.  I was saying that
> someone should take that code and implement it for the Unix TTY.

Aha, ok. So I guess I was right to assume that this already exists, I just 
missed that it exists only for the DOS build. Understood. :-)

Unfortunately, as much as I would like to see those menus in Unix TTY, I don't 
think that I have enough knowledge to actually port the code. :-( Maybe one 
day...
 
> > I've never ever
> > seen any other text editor do that. Even the KMail composer that I'm
> > typing into right now counts the first column as "column 1"... I'm a bit
> > dissapointed that such a weird default counting was chosen
> 
> Most of the software you see today copycats Microsoft Windows GUI
> style, so it's no surprise they all look similar and different from
> Emacs.  Emacs predates all of them.  So if you want to talk about
> weird defaults, it's those other programs that are "weird" ;-)

Oh, but I didn't use "weird" in the "different from MS editors" sense, but in 
the "why would anyone want to count columns from zero?" sense. The fact that 
Emacs was designed before most other editors is something I appreciate, but it 
has nothing to do with the default being "weird" (tradition notwithstanding).

If it's too hard to reconfigure, then ok, I'll live with it, but... it's weird. 
;-)
 
> Take a look at tty-color-define, this is the function you want to
> use.  And please be sure to look more carefully the commentary and the
> code of the packages you are pointed to: they have all this
> information spelled out.  For example, term/xterm.el includes a
> function names xterm-register-default-colors, which shows how to
> associate color names with colors supported by the xterm.  You should
> do something similar, but with color names you want to use.

Ok, I think I resolved this issue. The point that I was missing was that the 
256 colors displayed by the terminal are not neccessarily RGB-equivalent to 
the 256 colors defined in the rgb.txt file.

So while color-name-rgb-alist variable contains the colors from rgb.txt, the 
list-colors-display doesn't display those colors, but the colors that the 
terminal actually supports, which might be different (and are, in my case). 
Those (actually used) colors are listed in tty-defined-color-alist, and I see 
that they have names like color-16, color-17, etc.

The problem is that those two sets of colors are different from each other, and 
the tty-colors.el infrastructure approximates the standard ones with the ones 
available. IOW, there is no unique way to rename "color-16" to the standard 
name from rgb.txt (what I was hoping to achieve), since this color isn't even 
defined there.

So, if I want to configure syntax highlighting using the colors that I actually 
see on the screen, it seems that the simplest way is to just stick to the 
"color-##" names and forget about rgb.txt. :-)

Thanks for the help, now I know what I'm doing. ;-)

Incidentally, the tty-colors.el is apparently already built in my default 
Emacs install, I didn't even need to load it separately. I just needed to 
understand that the colors I see on the screen are *not* the colors defined in 
rgb.txt. :-)

> > > See indent-tabs-mode and tab-width.
> > 
> > Ok, I have RTFM for those variables (and hopefully understood it), set
> > 
> > (setq-default indent-tabs-mode nil)
> > (setq-default tab-width 4)
> > 
> > in the .emacs, restarted Emacs, and when I press the TAB key in the
> > buffer, nothing happens.
> 
> What is your value of tab-always-indent?

If I set it to t, TAB does nothing. If I set it to nil, then it works as 
expected when I am in the middle of a line. However, if I am at the beginning 
of the line, I need to press it twice --- the first TAB is swallowed, the 
second TAB prints spaces.

So I guess nil is what I want. I'm just confused why it swallows the first TAB 
when it is at the beginning of the line? The description says:

If t, hitting TAB always just indents the current line.
If nil, hitting TAB indents the current line if point is at the left margin
or in the line's indentation, otherwise it inserts a "real" TAB character.

AFAICS, there is some 'procedure of indentation' that does nothing in my case, 
while inserting the "real" TAB character is replaced with the four spaces, as 
I wanted. So how is this indentation being done, if not by inserting tabs or 
spaces into a file? The first time I press TAB, the line is apparently just 
being internally "marked" as indented (without anything visible actually 
happening), and only then the second TAB actually inserts something into the 
buffer. Am I understanding this right?

Btw, sorry for spamming the list with these things, I'm just trying to learn 
some of this basic stuff... :-)

Best, :-)
Marko




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

* Re: Several beginner-questions
  2011-07-28 22:07       ` Marko Vojinovic
@ 2011-07-29  6:08         ` Eli Zaretskii
  2011-07-29 18:07           ` Vijay Lakshminarayanan
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2011-07-29  6:08 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Marko Vojinovic <vvmarko@gmail.com>
> Date: Thu, 28 Jul 2011 23:07:17 +0100
> 
> If it's too hard to reconfigure, then ok, I'll live with it, but... it's weird. 
> ;-)

Feel free to file a feature request with the Emacs bug tracker, using
the "M-x report-emacs-bug RET" command.  It shouldn't be hard to
implement a variant of column-number-mode that shows columns 1-based.

> Ok, I think I resolved this issue. The point that I was missing was that the 
> 256 colors displayed by the terminal are not neccessarily RGB-equivalent to 
> the 256 colors defined in the rgb.txt file.

They are just strings.  The RGB equivalents are considered at a
different level.

> So while color-name-rgb-alist variable contains the colors from rgb.txt, the 
> list-colors-display doesn't display those colors, but the colors that the 
> terminal actually supports, which might be different (and are, in my case). 
> Those (actually used) colors are listed in tty-defined-color-alist, and I see 
> that they have names like color-16, color-17, etc.

Correct.

> IOW, there is no unique way to rename "color-16" to the standard 
> name from rgb.txt (what I was hoping to achieve), since this color isn't even 
> defined there.

You don't need to rename the existing "color-NN" names.  All you need
is to _add_ to tty-defined-color-alist the names from rgb.txt.
There's no problem to have more than 1 name pointing to the same color
index.  Use tty-color-define for this.

> Incidentally, the tty-colors.el is apparently already built in my default 
> Emacs install, I didn't even need to load it separately.

Yes, it is preloaded, because Emacs on a TTY always needs it.

> If I set it to t, TAB does nothing. If I set it to nil, then it works as 
> expected when I am in the middle of a line. However, if I am at the beginning 
> of the line, I need to press it twice --- the first TAB is swallowed, the 
> second TAB prints spaces.

It's not swallowed.  Emacs doesn't indent empty lines when you type
TAB.  This is done by the newline-and-indent command, by default bound
to the C-j (a.k.a. Linefeed) key.  If you don't have such a key on
your keyboard (most modern keyboards don't), bind that command to the
Return key, like this:

     (global-set-key "\C-m" 'newline-and-indent)

Then Emacs will indent a new empty line whenever you hit RET at the
end of the previous line.  See the node "Basic Indent" in the EMacs
user manual, for more details.

> So how is this indentation being done, if not by inserting tabs or 
> spaces into a file? The first time I press TAB, the line is apparently just 
> being internally "marked" as indented (without anything visible actually 
> happening), and only then the second TAB actually inserts something into the 
> buffer. Am I understanding this right?

No, see above.  I really suggest to read the manual on this.

> Btw, sorry for spamming the list with these things, I'm just trying to learn 
> some of this basic stuff... :-)

This list _is_ for such "spamming", but I recommend to become
acquainted with the manual and the various Emacs build-in help
facilities (see the node "Help" in the manual).  They will make you
much more independent in your uses of Emacs, because most answers are
in the docs already, you just need to grasp the tools that let you
find them efficiently.  Then you will need to ask questions here only
if you didn't find in the docs what you were looking for.



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

* Re: Several beginner-questions
  2011-07-29  6:08         ` Eli Zaretskii
@ 2011-07-29 18:07           ` Vijay Lakshminarayanan
  0 siblings, 0 replies; 15+ messages in thread
From: Vijay Lakshminarayanan @ 2011-07-29 18:07 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Jul 29, 2011 at 11:38 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> If I set it to t, TAB does nothing. If I set it to nil, then it works as
>> expected when I am in the middle of a line. However, if I am at the beginning
>> of the line, I need to press it twice --- the first TAB is swallowed, the
>> second TAB prints spaces.
>
> It's not swallowed.  Emacs doesn't indent empty lines when you type
> TAB.  This is done by the newline-and-indent command, by default bound
> to the C-j (a.k.a. Linefeed) key.  If you don't have such a key on
> your keyboard (most modern keyboards don't), bind that command to the
> Return key, like this:
>
>     (global-set-key "\C-m" 'newline-and-indent)
>

I personally swap C-m and C-j.  From my .emacs:

(defun swap-cj-cm ()
  (local-set-key (kbd "C-m") 'newline-and-indent)
  (local-set-key (kbd "C-j") 'newline))

(global-set-key (kbd "C-m") 'newline-and-indent)
(global-set-key (kbd "C-j") 'newline)

I use the function in some mode hooks that rudely set their own
keybindings for C-m/C-j but for the most part, I swap the meanings of
C-m and C-j to reflect my common usage.

Hope it helps.

-- 
Cheers
~vijay

btw, am I the only one who feels that gnus is /way/ too simple and
should be more complicated?



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

* Re: Several beginner-questions
  2011-07-27  1:36     ` suvayu ali
@ 2011-08-15  0:36       ` Ken Goldman
  0 siblings, 0 replies; 15+ messages in thread
From: Ken Goldman @ 2011-08-15  0:36 UTC (permalink / raw)
  To: help-gnu-emacs

On 7/26/2011 9:36 PM, suvayu ali wrote:
> Hey Marko,
>
> On Wed, Jul 27, 2011 at 3:05 AM, Marko Vojinovic<vvmarko@gmail.com>  wrote:
>> Oh yes, I tried it, and it looks rather cool. The problem is, however, that I
>> work quite often from a remote machine, via ssh, and without X. So I believe
>> that in my case it is a good idea to develop habits for using Emacs without
>> the gui, from ground up.
>>
>
> Emacs has a solution for everything! Try the amazing tramp package to
> edit remote files (although I am not sure whether auctex is "tramp
> aware"). `C-h i m TRAMP RET' That said, as far as I know reftex-mode
> works just fine on a terminal. You will only miss out on the latex
> previews in auctex.

That's one solution to working on a remote machine and yet have the 
power of emacs with X.

A bit off topic for an emacs group, but I typically connect to a remote 
machine with VNC, which gives the full power of a windowing system, 
including emacs.  The performance is quite good, even through a VPN.





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

* Re: Several beginner-questions
  2011-07-27  1:05   ` Marko Vojinovic
  2011-07-27  1:36     ` suvayu ali
@ 2011-08-15  0:39     ` Ken Goldman
  1 sibling, 0 replies; 15+ messages in thread
From: Ken Goldman @ 2011-08-15  0:39 UTC (permalink / raw)
  To: help-gnu-emacs

On 7/26/2011 9:05 PM, Marko Vojinovic wrote:
>
> Oh yes, I tried it, and it looks rather cool. The problem is, however, that I
> work quite often from a remote machine, via ssh, and without X. So I believe
> that in my case it is a good idea to develop habits for using Emacs without
> the gui, from ground up.
>
> If I got to the point of making some effort to learn and use a powerful text
> editor, I might as well learn it in a way that is platform/gui/os-independent.
> It should be a good investment of time.

I use emacs across many Unix and Windows variants on many platforms. 
emacs appears the same on all of them.

(except for a few of the key chords like ctrl-shift-pause)








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

end of thread, other threads:[~2011-08-15  0:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-24 22:22 Several beginner-questions Marko Vojinovic
2011-07-25 15:06 ` suvayu ali
2011-07-27  1:05   ` Marko Vojinovic
2011-07-27  1:36     ` suvayu ali
2011-08-15  0:36       ` Ken Goldman
2011-08-15  0:39     ` Ken Goldman
2011-07-25 15:14 ` Eli Zaretskii
2011-07-27  2:57   ` Marko Vojinovic
2011-07-27  5:40     ` Eli Zaretskii
2011-07-28 22:07       ` Marko Vojinovic
2011-07-29  6:08         ` Eli Zaretskii
2011-07-29 18:07           ` Vijay Lakshminarayanan
2011-07-27  6:48     ` Teemu Likonen
2011-07-27 13:57       ` Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2011-07-23  7:13 Marko Vojinovic

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.