I am trying to disable prettify-symbols-mode when I use emacs in the terminal. The reason is that unicode support in the terminal is not as good as in the GUI mode. So it causes a problem with editing my R scripts.
Here is what I came up with to put in my emacs config:
(add-hook 'after-make-frame-functions
(lambda ()
(when (not (display-graphic-p))
(prettify-symbols-mode -1)
)
)
)
This seems to work when I start emacs with emacs -nw. But it emacsclient quits immediately after it finishes starting up emacs daemon.
Related
After following instructions from https://www.emacswiki.org/emacs/EmacsMsWindowsIntegration
on starting emacs 27.1 as daemon in windows 10 where path\to\emacs is
"c:\emacs-27.1\bin\runemacs.exe --daemon , see here:
You can also open Explorer, type in shell:startup in the address bar, and press enter. In this startup >folder, create a shortcut by right clicking and selecting new->shortcut. When asked for location, put >the following: "X:\path\to\emacs\bin\runemacs.exe" --daemon where you have substituted the proper path >to runemacs.exe. This shortcut will run at startup. You can double click on the shortcut to start the >Emacs server if it is not already running.
Emacs daemon loads initialization file in c:/emacs-27.1/.config/emacs/init.el and properly so far defines ever function, only there are key-bindings initialized in the init and listed under describe-personal-keybindings that don't work when emacsclientw.exe starts.
They are bindings that were initially reserved for windows and decoded then recoded in the init.
This guy, for example, doesn't play nicely (nothing happens after C-m) in a client connected to a daemon, but works just fine when emacs is started with a frame.
(define-key input-decode-map [?\C-m] [C-m])
; translate it as synonymous with <apps> key
(define-key key-translation-map (kbd "<apps>") (kbd "<C-m>"))
;create a prefix command
(define-prefix-command 'super-keymap)
;set C-m as the prefix-command (note s- is also enabled now, so all C-m can be run with s-)
(global-set-key (kbd "<C-m>") super-keymap)
The same bug occurs after rebinding these guys C-[ and C-]
;rebind C-] keys
;rebind abort-recursive-edit, ESC will work on windows
(global-unset-key (kbd "C-]"))
(define-key input-decode-map (kbd "C-[") [control-bracketleft])
(bind-key [control-bracketleft] 'sp-backward-sexp)
(global-unset-key (kbd "C-]"))
(define-key input-decode-map (kbd "C-]") [control-bracketright])
(bind-key [control-bracketright] 'sp-forward-sexp)
The daemon doesn't of course open up a frame when it launches, hence likely it's in terminal mode. Maybe those keys on windows are not accessible from the same commands in terminal mode? Or is something else going on here?
Any takers?
Solution for me was to run the client with arguments.
pathTo/emacsclientw.exe -n -c -a "" -e "(rebind-keys)"
(defun rebind keys ()
(progn
(bind "C-x" 'bound-function-x')
(bind "C-y" 'bound-function-y')))
In Terminal, I can erase the entire input by Ctrl-U, without invoke it. Is there such a command in Eshell?
You're looking for eshell-kill-input, which is bound to C-c C-u by default.
I don't think that eshell natively supports killing the entire input string (it only kills the text between point and the prompt), but some advice should take care of that:
;;; For Emacs 24.4 and later
(defun eshell-kill-input--go-to-eol ()
"Go to end of line before killing input"
(end-of-line))
(advice-add 'eshell-kill-input :before #'eshell-kill-input--go-to-eol)
;;; For Emacs versions before 24.4
(defadvice eshell-kill-input (before go-to-eol ())
"Go to end of line before killing input"
(end-of-line))
In my .emacs, It contains the following two parts of codes.
I am debugging two programs together, one is server, and the other is client.
Everytime switching the debuged program, it is necessary to modify the .erlang for switching the code:add_paths statements and reopening the emacs. (In server and client programs, 3 modules are same, if not switching, the module conflict.
Because reopening emacs is much time-costing ( many files have to be reopened), is it possible for make two .erlang file effective with reopening emacs.
(erlang-shell)
(add-hook 'erlang-mode-hook
(lambda ()
(setq inferior-erlang-machine-options '("-name" "emacs"))
;(setq inferior-erlang-machine-options '("-name" "emacs""-mnesia dir"
"/Users/yuchen/Documents
/Project/mnesia_db") )
(set (make-local-variable 'compile-command) (format "make -f %s"
(get-closest-pathname)))
(imenu-add-to-menubar "imenu")))
You just need to finish your erlang session (switch to *erlang* buffer, enter q(). and press ENTER), edit ~/.erlang and start erlang again with erlang-shell
I'm using python-mode 6.0.1 on OS X, emacs 23.3 (http://emacsformacosx.com/ version).
I'm trying to get C-c C-c to default to python 3.
I have the following in my .emacs:
(setq py-python-command "/usr/local/bin/python3")
And when I run C-h b py-python-command, it tells me the value is that (correctly).
However, running C-c C-c still opens 2.7.2.
I also tried adding:
(setq py-which-shell "/usr/local/bin/python3")
as suggested here: Both Python 2 and 3 in Emacs, but that doesn't change anything (py-which-shell does get changed, but it still launches 2.7.2).
Any ideas?
Try adding the following code to your Emacs init file:
(add-hook 'python-mode-hook
(lambda ()
(setq py-python-command "python3")
(setq py-default-interpreter "python3")))
py-default-interpreter for now is an alias only, delivered for backward compatibility
You might have encountered a bug.
Please file a report giving some example code at
https://bugs.launchpad.net/python-mode
Should the buffer code contain a shebang specifying pythonVERSION , than this takes precedence over default setting.
You may enforce executing buffer through specific pythonVERSION by calling
a command of class py-execute-buffer-pythonVERSION
See menu PyExec, entry Execute buffer ...
On Emacs, when I start python with C-c ! while editing a remote python file (using tramp - plinkx: on windows), the python interpreter is started on the remote host.
Is there any way I can edit the remote python file and start a local python interpreter?
I am using python-mode (not the default python.el)
python-mode creates an inferior process via 'make-comint, which uses 'start-file-process, which creates the process relative to the variable 'default-directory. So there are a few ways you can tackle this beast.
The first is to change 'default-directory to be something local, like:
(add-hook 'python-mode-hook (lambda () (setq default-directory "~"))
That has the downside that C-x C-f now behaves differently (starting at ~).
Another is to change the 'default-directory just for the invocation of 'py-shell, like so (untested):
(defadvice py-shell (around py-shell-different-directory activate)
"set default-directory just for py-shell"
(let ((default-directory "~"))
ad-do-it))