Aquamacs (on Mac lion): whatever I write i being interpreted as "Enter" - python

I am editing a python script that I wrote a while ago, using aquamacs on Mac lion.
Whichever letter or number I type is being interpreted as "enter" (that is, I hit "g" for example, my text is dissrupted and a newline appears, but "g" does not appear). Restarting aquamacs, the terminal out of which I run it, or the whole computer did not help.
Other observations (that might or might not be connected):
- The script is located in a folder under Dropbox
- The file has special attributes (that is an "#" appears at the end of the permissions, upon typing ls -lah)
- I might have hit a combination of Control, Apple and other keys that I should not have ....
Any solution to this would be very much appreciated (and my apologies, if that has been treated before).
Thanks!

I also met with this problem recently.
You need to add minor mode Fill. Press on the Python in the mode line in mouse-3 way and choose Auto Fill.

Related

Why do control keys and arrow keys not work in pycharm?

I use MobaXterm to control linux server remotely from my windows desktop. I use Linux and pycharm 2019.3 in the linux server for nearly one whole year. During the past year I can not use control keys in pycharm. To be specific, when I press arrow left, endless number 4 will be inserted in pycharm until I type a normal character from a to z. Similary, when I press arrow right, up, and down, endless 6, 8, and 2 will be inserted. Furthermore, when I press insert, delete,home, end, page up, and page down, endless number 0,.,7,1,9, and 3 will be inserted into pycharm editor area until I press backspace or a normal character.
I tried to upgrade my pycharm from 2019.3 to 2020.2, but the same issue still exist.
I can not delete any thing, I have to use backspace to replace delete, it is awful。
I have been suffering the problem for one year. Please help me!
-----update------
I also found that when I disable the number lock, I can still type normal number using numeric keypad. Very weird.
-----update2-----
I found when I open the pycharm and just press control keys, everything goes well. But once I press a normal character (like a-z), this will trigger the issue, after that, control keys will not work normally.
-----update3-----
I uninstalled pycharm completely, and install it again. the issue still exist.
I restored default setting, the issue still exist.
-----update4----- This issue is related to: https://youtrack.jetbrains.com/issue/IDEA-150932
and
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206345169-Scrolling-with-keys-on-numeric-keypad-with-num-lock-off?input_string=Using%20Numeric%20Keypad%20Arrow%20Keys%20in%20CLion
-----update5----- This issue only exist in pycharm. Everything works correctly outside pycharm.
I know why! How to fix PyCharm keyboard keymap numpad left, right, up & down Ctrl BUGs
PyCharm latest version 2021.2 and many previous versions have 3 types of bugs in Keymap usually with larger keyboards with numpads on the right. (There are more bugs/Trojans in plug-in specific keymaps, that may already use or have conflicting uses of key+mouse+key combinations.)
First to fix the bug (eg missing numpad "left" arrow), open pycharm:
(optional) Update pycharm+its plug-ins and restart.
(optional) Running out of disk space? Delete ONLY the older backup PyCharmCE??? directories that do not match your
[ Help --> About --> Version ] value. Those configuration directories under Linux are ~/.cache/JetBrains/. Obviously do not delete the current PyCharmCE??? version. Windows has a similar set, I think. The bug here is the .cache/JetBrains directories are HUGE, and pycharm update fails to delete the oldest versions 3 versions back!
Go to the editors main Keymap: Ctrl+Alt+s --> Keymap --> Editor Actions and find the keystrokes that offend you, in my case "up" "down" "left" and "right" which are PyChuggyBuggeyWuggy dead unresponsive keys on the numpad.
Strange you will find "up" "down" "left" and "right" already coded into that list. All you do is add the keystroke of interest for each, even if it already looks good, IT IS NOT!
Each action in the Keymap list can have one or more keystrokes. Do not delete the existing keystroke, you will be adding your new one.
Double click on the chosen key in that very long Keymap list eg "left" --> "Add keyboard shortcut" (Confusingly it already says "Left" ignore that, it means non-numpad left, it is a bug).
JUST PRESS YOUR OWN LEFT arrow key (on the numpad) on the keyboard. then press OK. A new left appears, it looks the same but is not ... BUG!
Press Apply --> OK. It just added ANOTHER Left. That is actually a different Left! (That is a BUG and it should say "numpad left"). Test your changes.
For ANY other keystroke or mouse+key combo you can do the same thing, pycharm
may not record the "name" of the action correctly, but it will remember the combo for correct use against each list under: Ctrl+Alt+s --> Keymap --> Editor Actions
MAJOR BUG2 PyCharm SECURITY FLAW. Pycharm repeadedly phones home along with PlugIn violating security at least 160 times a day! Not
asking your permission. The atom editor and sublime do the same, do
not tolerate that, BLOCK THEM with the firewall.
MAJOR BUG3 PyCharm SECURITY FLAW. Plugins have the ability to intercept any and every keystroke and use the Keymap.
Many of the plug-ins are "builtin" and others are optional. They can be updated with fake versions that are trojan horses that capture
keystrokes. I do not see any way of verifying plug-ins, but I do see them violating security and phoning home information without your permission.

What does it mean to "restart" a program (in my case IDLE)?

This answer on Stack Overflow offers a solution I am trying to implement. In particular, see the sections "Installation Instructions" and "How to Use".
Can anyone tell me the steps required to "restart" IDLE?
New Information:
Just as people have suggested I thought this simply meant closing the program and opening it back up again...but I already tried that.
The other twist to my situation is that I'm working on a virtual machine so I was unable to do the installation of IDLE2HTML.py myself. My work's Help Desk had to do it so I cannot speak for the accuracy of their work. For now I'm assuming they did it correctly, but when I go to the "Options" menu there is no option to "Save as HTML".
My only guess at this point is that I still need to "restart IDLE".
Just wanted to double check if there was something else I could do before going back to my Help Desk department.
IDLE reads the idlelib/config-xyz.def files, including config-extensions.def, just once, when it starts. So any changes to config-extensions.def only takes effect the next time you start IDLE.
If you do not see 'Save as HTML' after starting IDLE, the extension is not installed properly.
It means you need to close the IDLE so that any changes made by the script can affect the IDLE
Simply close the IDLE either via the X, Ctrl+Q or File>Exit, then open the IDLE again.
If you are using idlelib module from a Python program then close your program and run it again.

How to copy text from IDLE?

Is there a way to copy text out of Python IDLE on a Mac? When I highlight text and copy then past into a text editor, I get the same text pasted. It is some of the first text I start with in IDLE. None of the other text will copy out.
From The Things I Hate About IDLE That I Wish Someone Would Fix (from 2011):
1.2) NEW FEATURE: Auto-Copy-On-Highlight
Once we get rid of being able to move the cursor off the last line, that opens a new opportunity to implement an automatic copy-on-highlight feature that many terminal and IRC client programs implement. Since this text is read-only, the only reason a person has for highlighting it is to copy it (they can’t delete it.) As soon as the user highlights text in the shell window, it is copied to the clipboard.
Looks like the best you can do is save as a .py file. Open that in a text editor and continue working in IDLE. With each save, the text editor will refresh with all updates, including errors. At least TextWrangler will.
Sometimes in things like a linux terminal you can't do a normal copy and paste, try holding Command/Control + Shift + C after highlighting things and seeing if that works, since you're on mac i'm not sure if it would be the Command or Control key so try both
EDIT: There is an apple discussion about the exact same thing. They discuss going into the options menu, then into configuration and navigating to the keys section. Then you use a built in key-set, their suggestion is using IDLE Classic Mac.
I cannot tell from your description exactly what you did and what happened. But I can recommend that you upgrade to 3.4.4 or 3.5.1 (or 2.7.11 for 2.7 users). Among other improvements, they all contain a patch to make right-click for context menu work on Mac Aqua. This was issue 24801 on the CPython bug tracker.
If there is still an actual problem on Mac, I would like to know so it can be fixed.

Lost in pudb command line area

I'm starting to use pudb for Python debugging. It comes up fine, and I can step through, and it stops at breakpoints I put into code with pudb.set_trace(). So far so good. The main problem I'm having is this:
If I hit ^X to get to the command-line pane, I can type executable lines or variable names, like running interactive Python, but the slightest typo (or experiment in search of other commands, or request for help()) lands me in a state I can't recover from. Even Control-c (as claimed at https://docs.python.org/2/tutorial/appendix.html#tut-interac) just shows up as "^C" and does nothing.
For example, if I type "help()", it prints some Python (not pudb) help, redisplays "help()" in yellow, and then I'm dead in the water. Backspace won't affect the "help()" that's displayed, and ^H just gets displayed as caret + H -- until I hit return, when it seems to be appended to "help()" as literal backspaces, since I can make part of all of "help()" disappear. I can type anything after "help()", but I always get:
SyntaxError: unexpected EOF while parsing
followed by a redisplay of what I had typed. How do I "clear" this state and get back to the normal command line, short of quitting my terminal program?
Using Terminal on Mac OS X 10.9.5, though I can also try Linux.
Your description points not to a problem with pudb but rather to a problem with behaviour of Backspace on the Terminal you're using.
Please try changing this behaviour so it's sending the proper Backspace. This could be helpful: http://fredericiana.com/2006/10/16/fixing-backspace-and-delete-for-ssh-in-os-xs-terminalapp/
Then, you should be able to enter pudb's full screen Python interpreter by '!' and leave it by Control-D.
A "small" Python command line inside pudb's interface can be accessed by Control-X and you can leave it by Control-X. In this one you have three other shortcuts which also let you manipulate the command line: Control-V - insert new line and Control-N/Control-P to browse command line history. If any of these is not working it's rather an issue with the way the Terminal treats these shortcuts and not in the way pudb does.

Using the emacs bindings in pycharm in OS X Lion

I am trying to use the emacs keybindings in Pycharm 1.5 in OS X 10.7. They all work except that ALT+B inserts a beta symbol rather than moving back a word. It's puzzling since ALT+F does correctly move forward a word.
Also, I was wondering if Pycharm has support for moving between matching parentheses or brackets, like Control-Meta-F in emacs. I didn't see an option for this in the Pycharm keybindings preference pane.
Thanks!
I found a solution on the JetBrains forum. The forum post includes a keymap as an attachment that globally disables the alt keys from generating symbols.
Quoting the forum,
"So, after some digging around, I figured that this option key maps to these relatively unused symbols that are take precedence in the operating system. Using http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele (Ukelele), I was able to generate an optimized Emacs keyboard layout. You should take this and put it in your /Library/Keyboard Layouts/ folder.
Reboot, and switch to use this keyboard layout on the Mac OSX toolbar and the option key will be free for hotkeying in PyCharm. I'll write up a blog post about this later.
Hope this helps."
esc-ctrl-b works for me, but alt-b doesn't. It's right there in the emacs keymap, so it's strange at first, but I think the problem is that alt-b is mapped to a character (∫ rather than ß in my case) so PyCharm doesn't see it as a key-modifier pair, just a single character.
Switching to a different international keyboard map will change which combinations work and which don't. I'd suggest sending a bug report to PyCharm as it's something they can fix, or alternatively you'll have to hack your keyboard mapping somehow.
To answer your other question, I don't think that there's a way to go to matching parenthesis, or at least I've never found one.

Categories