magit and /usr/bin/emacsclient --socket-name=/tmp/emacs1000/server - emacs

emacsclient 26.1
emacs 26.1
Magit 20180604.958, Git 2.17.1, Emacs 26.1, gnu/linux
My emacs is configured to work in a daemon mode
when I'm trying to commit a staged file, I get this:
GitError! There was a problem with the editor '/usr/bin/emacsclient --socket-name=/tmp/emacs1000/server
and inside magit process window I see this
0 git … add -u .
1 git … commit --all --no-verify
hint: Waiting for your editor to close the file...
Waiting for Emacs...
*ERROR*: Symbol’s function definition is void: magit-process
error: There was a problem with the editor '/usr/bin/emacsclient --socket-name=/tmp/emacs1000/server'.
Please supply the message using either -m or -F option.
~/.config/systemd/user/emacsd.service
[Unit]
Description=Emacs: the extensible, self-documenting text editor
Documentation=man:emacs(1) info:Emacs
[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook nil) (kill emacs))"
Environment=DISPLAY=:%i
TimeoutStartSec=0
Restart=on-failure
[Install]
WantedBy=default.target
I have the following variables
alias emacs='lc_collate=c emacsclient -c -n "$#"'
and
➜ frontend git:(experiment) ✗ echo $EDITOR
/usr/bin/eclient
➜ frontend git:(experiment) ✗ cat /usr/bin/eclient
#!/bin/bash
/usr/bin/emacsclient -c -nw "$#"
I also get these messages
Revert buffer from file /home/dmitry/Projects/p/frontend/.git/COMMIT_EDITMSG? (y or n)

I had the same problem after upgrading Emacs from 26 to 27. Problem was resolved after I cleaned .emacs.d folder (git clean -xdf will do the trick if configs are saved in git).

Related

A plug-in doesn't work after installing on VIm

I was trying to install a plug-in "vim-surround" but it doesn't work after executing the following commands on my terminal.
$ mkdir -p ~/.vim/pack/tpope/start
$ cd ~/.vim/pack/tpope/start
$ git clone https://tpope.io/vim/surround.git
$ vim -u NONE -c "helptags surround/doc" -c q
I'm new to Vim and I was wondering if there's more to just typing those commands on the terminal? Do I have to add some lines on the config file to make it work?
Thank you in advance.

How do you override/remove default completions in fish shell?

I am adding completions for a command's subcommand, however fish is retaining the built in completions for the base command, but those no longer apply for the subcommand. I want to disable those base command completions when using the subcommand.
So, to give a specific example, I am adding complete completions for the python3 -m venv command. As I stated, all the builtin python3 completions still show even though they no longer apply. So, when I type python3 -m venv -<TAB>, I get the completions I've added (good!), but also all the default completions too (bad).
So I have this code:
function __fish_python_using_command
# make sure that the command (minus the first item) matches argv
set cmd (commandline -opc)
if [ (count $cmd) -le (count $argv) ]
return 1
end
set idx (math (count $argv)+1)
if [ "$argv" = "$cmd[2..$idx]" ]
return 0
end
return 1
end
complete -f -c python3 -n '__fish_python_using_command -m venv' -s h -l help -d 'Display help creating virtual Python environments'
After running this, when I type when I type python3 -m venv -<TAB> I get:
The new auto complete I defined for --help (correct)
The base defined auto complete for -h (wrong)
All the other python3 base auto complete switches like -V from complete --command python3 --short-option 'V' --description 'Display version and exit' (I want to disable these)
I have considered using the -e flag to remove the defaults when you are in python3 -m venv mode, but that seems like the wrong way to go about it. I'm stumped. How would one disable all existing completions once a subcommand mode is entered? Or would this require a fundamental change to the way the python3 fish builtin completions are structured?
Fish loads completions from files in $fish_complete_path. This is a list of directories, like $PATH. Put your completions into a file named after the command with a ".fish" suffix in an earlier directory and it will take precedence.
E.g. ~/.config/fish/completions/python3.fish.

Dockerized emacs not loading extensions

I'm experimenting with Dockerizing some GUI applications after being inspired by an excellent blog post on the topic. I'm working on getting spacemacs up and running, because spacemacs is awesome. But for some reason Docker doesn't seem to be cloning the spacemacs repo as expected.
My Dockerfile is:
# Run spacemacs in a contianer
#
# sudo docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY garry-cairns/spacemacs
#
FROM ubuntu:14.04
MAINTAINER Garry Cairns
ENV REFRESHED_AT 2015-06-29
# get base components
RUN ["apt-get", "-y", "install", "emacs", "git"]
# move into our working directory
# ADD must be after chown see http://stackoverflow.com/a/26145444/1281947
RUN ["groupadd", "spacemacs"]
RUN ["useradd", "spacemacs", "-s", "/bin/bash", "-m", "-g", "spacemacs", "-G", "spacemacs"]
ENV HOME /home/spacemacs
WORKDIR /home/spacemacs
RUN ["chown", "-R", "spacemacs:spacemacs", "/home/spacemacs"]
# install emacs and spacemacs extensions
RUN ["git", "clone", "--recursive", "https://github.com/syl20bnr/spacemacs", "~/.emacs.d"]
# add local setup
ADD ./spacemacs .spacemacs
USER spacemacs:spacemacs
ENTRYPOINT ["emacs"]
As it says in the comment at the top of the file I run that with:
sudo docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --name spacemacs garry-cairns/spacemacs
That brings up a stock emacs on my display. If I look for files I can see a .emacs.d directory in ~/emacs but there's nothing in it hence no spacemacs extensions.
I've also tried just ADDing my own .emacs.d right where I add the .spacemacs file. Interestingly that brings up the spacemacs start screen I'd expect, with my preferred theme, but evil-mode isn't running. I expect other modes probably aren't running either but they're much harder to check than evil mode.
Can anyone suggest what more I could do to get this working?

Cant access Coda application from command-line

I am having trouble accessing Coda from command-line. I installed the "command-line coda" plug-in, verified that my installation is in the correct location, yet I still can seem to access Coda. Coda sits in my "Applications" folder which is the default location for the plug-in.
Anyone have have this problem? Any tips? On the their site it is recommended that you change the path.
export CODEPATH=/Applications/Coda.app
So I included the above line in my .bash_profile which did not help.
$ Coda -v
-bash: Coda: command not found
Thanks for any direction you can provide.
The default way to open an application on a Mac is to use open -a AppName so you should be able to change your bash profile to use that:
$ open -a Coda
I've created a bash script (as opposed to using the plugin) that Gregory Tomlinson originally posted about (it looks like he's since taken it down but it looks like the following).
Create a new file in /bin called coda:
$ cd /bin
$ sudo touch coda
$ vim coda
Hit an i to enter insert mode. Then include the following code:
#! /bin/bash
if [ "$1" = "" ]; then
echo "Please specify a file to open or create"
exit 0
else
for ARG in $*
do
touch -a $ARG && open -a Coda $ARG
done
exit 0
fi
Save and quit (hit the esc to exit insert mode then type :w !sudo tee % >/dev/null followed by the return key, press L for load when prompted, then type :q to quit). Then give that file execute permissions:
$ chmod u+x coda
Start a new Terminal window and you should be able to use:
$ coda filename.foo
Or just:
$ coda
For some strange reason, my paid registered Coda 2 app just wouldn't open for me this morning. I found this terminal command that worked for me:
open -a Coda\ 2
You can also put the following in your ~/.bash_profile file:
alias coda='open -a "Coda 2"'
I had a similar problem. After installing the plug-in, I still couldn't launch coda from the command line. I took a closer look at /user/local/bin and somehow the permissions had gotten reset so I didn't have execute permissions for /user/local/bin.
I updated my permissions with:
sudo chmod o=rx,g=rx /usr/local/bin
This solved my problem. However, Coda won't launch if the specified file does not exist, which makes it hard to create a file from the command line.

Desktop.el under emacsclient

I am trying to use desktop functionality (http://www.emacswiki.org/emacs/DeskTop) in emacs.
I added following code to my .emacs:
(require 'desktop)
(setq desktop-save t)
(setq desktop-load-locked-desktop t)
(setq *desktop-dir* (list (expand-file-name "~/.emacs.d/desktop")))
(setq desktop-base-file-name ".emacs.desktop")
(setq desktop-path *desktop-dir*)
(setq desktop-dir *desktop-dir*)
(desktop-save-mode 1)
(desktop-read)
If I use emacs like a standalone application, calling like "$emacs -nw", everything is fine, but when I try to use the same config with emacsclient, emacs just hangs on server starting.
Commenting out two last lines make emacs server start as expected.
See part of official Gentoo script from /etc/init.d to start emacs daemon.
: ${EMACS:=/usr/bin/emacs}
: ${EMACS_OPTS:=--daemon}
: ${EMACS_SHELL=/bin/bash}
: ${EMACS_START:=/usr/libexec/emacs/emacs-wrapper.sh}
: ${EMACS_TIMEOUT:=30}
: ${EMACS_SHUTDOWN_TIMEOUT:=10}
USER=${SVCNAME#*.}
PIDFILE_DIR=/var/run/emacs/${USER}
PIDFILE=${PIDFILE_DIR}/emacs.pid
...
local home
checkconfig || return 1
eval home="~${USER}"
SHELL=${EMACS_SHELL:-$(awk -F: "\$1 == \"${USER}\" { print \$7 }" \
/etc/passwd)}
export SHELL EMACS EMACS_TIMEOUT
ebegin "Starting Emacs daemon for user ${USER}"
if [ -z "${RC_SVCNAME}" ]; then
# baselayout-1
start-stop-daemon --start \
--user "${USER}" --exec "${EMACS}" --pidfile "${PIDFILE}" \
--chuid "${USER}" --chdir "${home}" --env HOME="${home}" \
--startas "${EMACS_START}" -- ${EMACS_OPTS}
else
# OpenRC
start-stop-daemon --start \
--user "${USER}" --pidfile "${PIDFILE}" --chdir "${home}" \
--exec "${EMACS_START}" -- ${EMACS_OPTS}
fi
eend $?
Is possible to debug emacsclient problems somehow?
Maybe someone could give a hint?
P.S. I am on Gentoo Linux, emacs-vcs-23.2.9999 package, terminal only.