473,465 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Python editing with emacs/wordstar key bindings.

Does anyone use emacs together with both WordStar key bindings and python
mode? I'm afraid that Wordstar editing key commands are burned R/O into my
knuckles!

I would like to play with emacs for Python editing but I'm having (2)
problems.

1) When I load a .py file, emacs automatically overrides my wordstar-mode
with python-mode, forcing all the keybindings back to emacs native keys.
Why?

Why should a python-mode care what key bindings are in use?

2) We get <tab> for block indentation instead of the spaces I prefer.

Is there a better python-mode script I should be using other than the
default that came with emacs?

Any tips/hints appreciated.
Thomas Bartkus
Apr 11 '06 #1
12 2797
"Thomas Bartkus" <th***********@comcast.net> writes:
[...]

1) When I load a .py file, emacs automatically overrides my wordstar-mode
with python-mode, forcing all the keybindings back to emacs native keys.
Why?

Why should a python-mode care what key bindings are in use?
No idea. Quite odd.

2) We get <tab> for block indentation instead of the spaces I prefer.
That's odd, I get four spaces unless I'm editing an existing file that
already uses some other convention, in which case python-mode is
usuall smart enough to figure that out. I don't use wordstar-mode.

Is there a better python-mode script I should be using other than the
default that came with emacs?


I assume you're using X/Emacs, then, rather than GNU Emacs?

IIRC, there's a separate sourceforge project for python-mode now, so
you could give that version a try.
John

Apr 12 '06 #2
"Thomas Bartkus" <th***********@comcast.net> writes:
[...]

1) When I load a .py file, emacs automatically overrides my wordstar-mode
with python-mode, forcing all the keybindings back to emacs native keys.
Why?

Why should a python-mode care what key bindings are in use?

2) We get <tab> for block indentation instead of the spaces I prefer.

[...]

Have you tried an emacs mailing list / newsgroup re these points? You
might get more help there...
John

Apr 12 '06 #3
Thomas Bartkus wrote:
Does anyone use emacs together with both WordStar key bindings and python
mode? I'm afraid that Wordstar editing key commands are burned R/O into my
knuckles!
Old Borland C user?

I would like to play with emacs for Python editing but I'm having (2)
problems.

1) When I load a .py file, emacs automatically overrides my wordstar-mode
with python-mode, forcing all the keybindings back to emacs native keys.
Why?

Why should a python-mode care what key bindings are in use?
Python and wordstar are both major modes. When python-mode is loaded,
it replaces (not sits atop of) wordstar-mode; you can't have two major
modes loaded at the same time.

If you want just want to use wordstar mode, you can prevent Emacs from
loading python mode by putting -*- mode: wordstar -*- on the first line
of the Python file (or second line if it uses a #!). Or, you could
remove python mode from the auto-mode-alist and interpreter-mode-alists
in your .emacs file, which I leave as an exercise.

2) We get <tab> for block indentation instead of the spaces I prefer.
In your .emacs file:

(setq indent-tabs-mode nil)

Is there a better python-mode script I should be using other than the
default that came with emacs?


I doubt there's one that solves your problem.
Carl Banks

Apr 13 '06 #4
"Carl Banks" <in**********@aerojockey.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Thomas Bartkus wrote:
Does anyone use emacs together with both WordStar key bindings and python mode? I'm afraid that Wordstar editing key commands are burned R/O into my knuckles!
Old Borland C user?


Worse than that! It starts with Wordstar itself on a terminal to cp/m.
It continued with Borland Pascal -> Delphi.

Wordstar key controls are the only key bindings that are ergonometric on a
qwerty keyboard. If you do serious typing, you don't break stride to issue
editing commands.
I would like to play with emacs for Python editing but I'm having (2)
problems.

1) When I load a .py file, emacs automatically overrides my wordstar-mode with python-mode, forcing all the keybindings back to emacs native keys.
Why?

Why should a python-mode care what key bindings are in use?


Python and wordstar are both major modes. When python-mode is loaded,
it replaces (not sits atop of) wordstar-mode; you can't have two major
modes loaded at the same time.

If you want just want to use wordstar mode, you can prevent Emacs from
loading python mode by putting -*- mode: wordstar -*- on the first line
of the Python file (or second line if it uses a #!). Or, you could
remove python mode from the auto-mode-alist and interpreter-mode-alists
in your .emacs file, which I leave as an exercise.


I do notice that I can invoke wordstar-mode *after* loading the .py file and
get the whole enchilada. The Wordstar key bindings with the syntax
highlighting.
It just strikes me as odd that key bindings should be reasserted by invoking
python-mode.

Perhaps python-mode shouldn't be an emacs "major mode".
We just want syntax highlighting and some minor formatting assist. Key
bindings have nothing to do with the language. I need to learn how to edit
the key re-assignment out of python-mode.el .
2) We get <tab> for block indentation instead of the spaces I prefer.


In your .emacs file:

(setq indent-tabs-mode nil)


Thank you. That helps
Is there a better python-mode script I should be using other than the
default that came with emacs?


I doubt there's one that solves your problem.


Yes.
The *real* problem here is that I need to get down and dirty with emacs/lisp
when all I started looking for was a more robust editor for Python ;-)
Carl Banks

Apr 13 '06 #5
>> When all I started looking for was a more robust editor for Python ;-)

Both WingIDE and Komodo Dragon allow for customization of keyboard
bindings. They aren't free, but they cost only $30.00 or so. Cheap for
what you get, especially in the case of Komodo because it makes a nice
editor for many languages--Perl, PHP, HTML etc.

I tried Xemacs several times over the years on Win XP. Something
usually breaks, and then--yes--you have to learn Lisp to fix it.

rpd

Apr 13 '06 #6
Thomas Bartkus wrote:
I do notice that I can invoke wordstar-mode *after* loading the .py file and
get the whole enchilada. The Wordstar key bindings with the syntax
highlighting.
It just strikes me as odd that key bindings should be reasserted by invoking
python-mode.


Ah--you're only thinking of syntax highlighting. Now it makes sense.

Try putting these lines in your .emacs:

(defun use-wordstar-for-python () (wordstar-mode))
(add-hook 'python-mode-hook 'use-wordstar-for-python)

There might be a "right" way to get syntax highlighting without setting
the major mode (if not, there ought to be), but this should do the
trick for you.
Carl Banks

Apr 13 '06 #7
"Carl Banks" <in**********@aerojockey.com> writes:
[...]
1) When I load a .py file, emacs automatically overrides my wordstar-mode
with python-mode, forcing all the keybindings back to emacs native keys.
Why? [...]
Python and wordstar are both major modes. When python-mode is loaded,
it replaces (not sits atop of) wordstar-mode; you can't have two major
modes loaded at the same time.


Oh, of course -- didn't occur to me that wordstar-mode might be a
major mode.

Thomas, why not simply use the standard emacs provisions for key
rebinding? Or are the wordstar keys modal or otherwise difficult to
implement that way, as is the case with vi bindings? (but viper does a
great job of that -- I'm using it right now)
[...] Is there a better python-mode script I should be using other than the
default that came with emacs?


I doubt there's one that solves your problem.


Carl is right: changing python-mode is the wrong end to approach this
problem. Change the keybindings instead.

Like I said, if you're stuck rebinding the keys, try one of the emacs
mailing lists / newsgroups. Thanks to the kind help of such people
I've been getting away with scandalously little knowledge of my own
..emacs for years, and only just now learning a little elisp. :-)
John

Apr 13 '06 #8
"BartlebyScrivener" <rp*******@gmail.com> writes:
When all I started looking for was a more robust editor for Python ;-)


Both WingIDE and Komodo Dragon allow for customization of keyboard
bindings. They aren't free, but they cost only $30.00 or so. Cheap for
what you get, especially in the case of Komodo because it makes a nice
editor for many languages--Perl, PHP, HTML etc.

I tried Xemacs several times over the years on Win XP. Something
usually breaks, and then--yes--you have to learn Lisp to fix it.


No, usually you just need to ask in one of (X)emacs groups/mailing
lists, and get a recipe in about a day, making it similar to learning to
use Python. And that drastically differs from trying to convince those $
companies to fix something for you ;)

-- Sergei.

Apr 14 '06 #9
Yes, but for some reason, I get more and better help here with Python
than on xemacs. Or maybe I've just had bad luck. Something like the
following just leaves me scratching my head. I'm on Windows XP and
never compiled anything that I know of. I'd rather pay $30 and have
the editor work.

"BartlebyScrivener" <rpdool...@gmail.com> writes:
I tried searching on this but I don't see exactly my error message.
When I open a php file for editing, I get: "file mode specification
error: (void-function run-mode-hooks)" What line do I need to add to my .init file to make this stop?


You are using .elc files compiled with a different version of Emacs.
Recompile them.

Apr 14 '06 #10
"BartlebyScrivener" <rp*******@gmail.com> writes:
Yes, but for some reason, I get more and better help here with Python
than on xemacs. Or maybe I've just had bad luck. Something like the
following just leaves me scratching my head. I'm on Windows XP and
never compiled anything that I know of. I'd rather pay $30 and have
the editor work.
Well, I'd pay too, but my experience is that no editor *always* works
for me, and ability to fix it (or fine-tune for my own needs) is indeed
essential for me. To the extreme that I'd rather learn some lisp to be
able to (and besides lisp being fun to learn) ;) That said, I do think
(X)emacs is not very suitable for casual user, but it starts to pay back
for investments put into it pretty soon.

BTW, what you've cited below sounds just like messed/broken Emacs
installation (maybe installing one version on top of another, or mixing
Emacs and XEmacs installations, or borrowing some files from separate
archives -- difficult to say exactly), as you normally don't need to
compile anything. Not to mention the fact that Windows is rather new
platform for emacsen, so quite a few OS-specific issues could well be
unresolved or simply be buggy indeed.

Well, I think we should better stop this as an OT anyway.

-- Sergei.

"BartlebyScrivener" <rpdool...@gmail.com> writes:
I tried searching on this but I don't see exactly my error message.
When I open a php file for editing, I get: "file mode specification
error: (void-function run-mode-hooks)"

What line do I need to add to my .init file to make this stop?


You are using .elc files compiled with a different version of Emacs.
Recompile them.

--
http://mail.python.org/mailman/listinfo/python-list


Apr 14 '06 #11
Yes, thanks. I was just going to reinstall anyway. That usually fixes
it.

Rick

Apr 14 '06 #12
This is new to me. I did not know that emacs HAD a word star mode.....
I may have to look at emacs again (last time was 1995).

I am still looking for a python editor I like. Yes I used to write asm
code in
wordstar in nondocument mode. And yes all of the old dos editors used
the wordstar keys. Everything by Borland used them.
Because of this I still use the 'joe' editor when I am on the command
line
and cooledit(with wstar like bindings) on X.
I like the features on other editors but I need my wstar keys.

Apr 14 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
9
by: Peter Wu | last post by:
I'm giving vim a try to program Python. The following are the steps I follow to code/test a python program. vi test.py :wq :!python test.py Is there any other way? I don't want to type...
49
IDE
by: Thomas Lindgaard | last post by:
Hello I am probably going to start a war now... but so be it :) I just want to hear what all you guys who eat pythons for breakfast use for python coding. Currently I use Kate, but I would...
29
by: seberino | last post by:
I'm trying to move beyond Emacs/Vim/Kate and was wondering if Eclipse is better and if it is the *best* IDE for Python. Should I leave Emacs and do Python coding in Eclipse? Chris
30
by: bblais | last post by:
Hello, Let me start by saying that I am coming from a background using Matlab (or Octave), and C++. I am going to outline the basic nuts-and-bolts of how I work in these languages, and ask for...
39
by: Jack | last post by:
I wonder what everybody uses for Python editor/IDE on Linux? I use PyScripter on Windows, which is very good. Not sure if there's something handy like that on Linux. I need to do some development...
331
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
14
by: jmDesktop | last post by:
Hi, I'm trying to learn Python. I using Aquamac an emac implementation with mac os x. I have a program. If I go to the command prompt and type pythong myprog.py, it works. Can the program be...
7
by: Michele Simionato | last post by:
I have noticed that the python-mode for Emacs that comes with the latest Ubuntu is missing the class browser. Moreover if works differently from the python-mode I was used to (for instance CTRL-c-c...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.