Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am one of those weirdos that likes running emacs from a terminal. I always do this because I sometimes must (when editing remotely through SSH), so I won't have to switch between a graphical editor and a terminal editor.
Usually, things work just fine. However, problems arise when I must send a "control-something" (like "C-RET" and "C-,") command to my editor. In graphical mode, this works fine. In a terminal, it does not.
In the current terminal that I am using (gnome-terminal), typing "C-RET" will send "C-j" to my editor. Furthermore, typing "C-," will send "," to my editor.
A non-solution would be to "not use these commands". However, I am using some major emacs modes (proofgeneral/coq-mode and agda2-mode), which have keyboard shortcuts like this:
These are very useful shortcuts, and I am crippled without them.
So far, I am getting around this issue by adding to my .emacs configuration file an entry which makes emacs behave as expected when emacs receives this incorrect command:
I would, however, prefer not to have to do this for every major mode I use. Furthermore, if a mode happens to use "C-c C-j", then this re-set keybinding will override it.
My question is the following:
PROBLEM: How do I ensure that emacs correctly interprets a "C-X" command, where X is *any* character?
A noteworthy detail here is that when I run emacs in an xterm, typing "C-," will in fact send "C-," to emacs. However, typing "C-RET" will send "C-<return>" to emacs. So the problem seems to be how the terminal translates a CTRL-something to a key, and sends it to emacs. So one solution could be to
SOL.1: Make sure your terminal sends the right signals to emacs.
However, this may not be possible (I am not about to dig into the belly of a terminal implementation, or to implement my own terminal emulator). Alternatively, we could accept that a terminal sends CTRL-something incorrectly to emacs / emacs interprets CTRL-something incorrectly. Accepting this, the solution to this problem would be to
SOL.2: Make sure emacs interprets the incorrect signals correctly.
A third option, which is probably the easiest one, is to realize that this is too challenging, and
SOL.3: Make sure that emacs reacts correctly when seeing "C-<return>", when emacs is run in an xterm.
(this seems to be the only problem with running emacs in an xterm.)
I am writing this here because I do not know how to proceed with any of these solutions, and am hoping someone here does.
I tried working more with xterm to have it understand all the CTRL-X I need, and realised that there is in fact no problem with "C-RET". However, "C-SPC" (control space) was a problem; emacs received "C-@". This seems to be the only issue with running emacs in an xterm.
Just in case this can cause problems, here are the configurations I made to xterm:
The xterm*metaSendsEscape: true turned out to be important, for else emacs would interpret "M-x" (alt x) as "ø" (a random forum somewhere suggested that this was an issue with using the UTF8 locale as opposed to the ISO8859-1 locale).
In case it is relevant, here is my (ugly) .emacs file.
> cat .emacs
;; Set default character encoding to UTF-8.
(set-input-mode (car (current-input-mode))
(nth 1 (current-input-mode))
(setq locale-coding-system 'utf-8)
;; Replace tabs with spaces, etc.
(setq-default tab-width 8)
(setq-default c-basic-offset 4)
(setq-default indent-tabs-mode nil)
;; Have emacs store temporary files in ~/.emacs-backup.
(defvar user-temporary-file-directory "~/.emacs-backup")
(make-directory user-temporary-file-directory t)
(setq backup-by-copying t)
`(("." . ,user-temporary-file-directory)
(concat user-temporary-file-directory ".auto-saves-"))
`((".*" ,user-temporary-file-directory t)))
;; remove toolbar in graphical emacs
;; remove scrollbar in graphical emacs
(if (null window-system)
(defvar config-is-graphical-window-system nil)
(defvar config-is-graphical-window-system t))
(setq auto-mode-alist (cons '("\\.jr$" . java-mode) auto-mode-alist))
(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(autoload 'coq-mode "coq" "Major mode for editing Coq vernacular." t)
(autoload 'proofgeneral "proofgeneral" "Generic front-end for proof assistants." t)
;;(global-set-key (kbd "C-c C-j") 'proof-goto-point)
;;(global-set-key (kbd "C-c ,") 'agda2-goal-and-context-and-inferred)
;; proofgeneral customization
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(agda2-include-dirs (quote ("." "/home/willard/Programs/Installed/lib-0.3/src"))))
;; abda setup
(load-file (let ((coding-system-for-read 'utf-8))
(shell-command-to-string "agda-mode locate")))
Currently, I have switched from gnome-terminal to using xterm, and am doing alright so far. However, if I would be able to use gnome-terminal instead without trouble, I would be much happier. Any suggestions on how to do this are much appreciated.
I am in a similar boat (a vim user, forced to use emacs because of Proof General). I mostly ssh (using putty) to my workstation from a windows laptop, which doesn't run the entire X server stack. I was wondering if you found a solution to make gnome-terminal (and putty, which is more relevant for me) send the right keys? I read somewhere that C-j is "return" for emacs and so it seems to me that the terminals are simply omitting the Ctrl key.