Emacs 24.5 with prelude stuck on contacting host melpa.org - emacs

I'm running emacs 24.5 installed via homebrew.
for some weird reason my emacs gets stuck on Contacting host: melpa.org:80
I even tried a fresh install of emacs (removed .emacs.d folder as well)
Also i'm able to ping the url melpa.org through terminal.
Any ideas on how to fix this.

Can you try switching to HTTPS? I have
(setq package-archives '(("org" . "http://orgmode.org/elpa/")
("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")))
;; from https://glyph.twistedmatrix.com/2015/11/editor-malware.html
;; needs "brew install gnutls" and "pip install certifi", perhaps with sudo
(let ((trustfile
(replace-regexp-in-string
"\\\\" "/"
(replace-regexp-in-string
"\n" ""
(shell-command-to-string "python -m certifi")))))
(setq tls-program
(list
(format "/usr/local/bin/gnutls-cli --insecure --x509cafile %s -p %%p %%h"
trustfile)))
(setq gnutls-verify-error t))

Related

Determine which of running servers, an emacsclient attached to?

I planed to starting emacs from the the start.sh as
$ head start.sh
#! /bin/bash
{
#starting emacs servers
emacs --daemon=orging
emacs --daemon=coding
#waiting...
#invoke emacsclients
emacsclient -c -s "orging" &
emacsclient -c -s "coding" &
......
} &> /dev/null
Two clients run respectively under servers of orging and coding.
A problem occurred to this situation is that the invoked running clients are not labelled with appropriate server names.
So a manual steps of testing might be need to determine who is who.
As an alternative, the servers could be scheduled with one running at the top , the other at the end after starting from in the start.sh,
How could determine which server a client attached in a straightforward way on a working frame?
You can inspect the variable server-name - interactively with C-h v server-name RET.

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

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).

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?

Vagrant / Clojure / Emacs

I want to put together a standard environment for exploring Clojure with Emacs. Has anyone got a recipe that would suit this? I'm thinking of a Vagrant system running a flavour of Ubuntu, with NREPL and some useful EMACS support plugins.
vagrant box add preciseMinimal http://goo.gl/wxdwM
Change to Clojure vagrant base folder
vagrant init preciseMinimal
vagrant up
vagrant ssh
or ssh to 127.0.0.1 port 2222 (or other port mentioned in "vagrant up" output)
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:cassou/emacs
sudo apt-get update
sudo apt-get install emacs24 emacs24-el emacs24-common-non-dfsg
sudo apt-get install clojure
cd ~/
mkdir bin
sed '$ a\
export PATH=~/bin:$PATH' ~/.bashrc
exit and reconnect to ssh
cd ~/bin
wget https://raw.github.com/technomancy/leiningen/preview/bin/lein
chmod +x lein
./lein
cd ~
cat >.emacs
; Package.el customization
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
;; install packages
(defvar my-packages '(
auto-complete
clojure-mode
clojure-test-mode
nrepl
ac-nrepl
paredit
rainbow-delimiters
))
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-refresh-contents)
(package-install p)))
;; The following line can be removed after first install to speed up startup
(byte-recompile-directory (expand-file-name "~/.emacs.d") 0)
(custom-set-variables
;; 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.
'(auto-save-default nil)
'(backup-inhibited t t)
'(cursor-type 'bar t)
'(column-number-mode t)
'(delete-selection-mode t)
'(inhibit-startup-screen t)
'(initial-scratch-message nil)
'(tool-bar-mode nil)
'(xterm-mouse-mode 1))
;; rainbow delimiters
(require 'rainbow-delimiters)
(global-rainbow-delimiters-mode)
;; paredit
(add-hook 'clojure-mode-hook 'paredit-mode)
(add-hook 'nrepl-mode-hook 'paredit-mode)
(global-set-key [f7] 'paredit-mode)
;; clojure-mode
(global-set-key [f9] 'nrepl-jack-in)
;; nrepl
(add-hook 'nrepl-interaction-mode-hook 'nrepl-turn-on-eldoc-mode)
(setq nrepl-popup-stacktraces nil)
(add-to-list 'same-window-buffer-names "*nrepl*")
(add-hook 'nrepl-mode-hook 'paredit-mode)
;; Auto complete
(require 'auto-complete-config)
(ac-config-default)
(define-key ac-completing-map "\M-/" 'ac-stop)
;; ac-nrepl
(require 'ac-nrepl)
(add-hook 'nrepl-mode-hook 'ac-nrepl-setup)
(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup)
(eval-after-load "auto-complete" '(add-to-list 'ac-modes 'nrepl-mode))
#CTRL-D to finish
Grateful attributions:
http://blog.worldcognition.com/2012/07/setting-up-emacs-for-clojure-programming.html
A Github hosted, shell provisioned vagrant setup is located here:
https://github.com/pattinsont/Ukelele
All that should be required is a checkout and vagrant up.
Once the VM is up, ssh onto box.
Run emacs to complete install.
Then M-x cider-jack-in

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.