Emacs被称为“神”的编辑器,在开始讲解Emacs使用前,我们首先介绍Emacs的安装。
有三种方法:
一些emacs特性需要一些unix工具支持,例如:
有几种方法来获得这些linux工具:
下面简要说明:
C:\\Users\\joe\\apps\\emacs-24.1\\bin\\emacs.exe --no-window-system
emacs25\bin目录下有很多执行文件,说明如下:
## mirrorlist.mingw32
##
## 32-bit Mingw-w64 repository mirrorlist
##
## 清华大学软件镜像
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686/
## 中科大镜像
Server = http://mirrors.ustc.edu.cn/msys2/mingw/i686/
## msys2.org
Server = http://repo.msys2.org/mingw/i686/
## Sourceforge 镜像
Server = https://sourceforge.net/projects/msys2/files/REPOS/MINGW/i686/
## The UK Mirror Service Sourceforge mirror
Server = http://sourceforge.mirrorservice.org/m/ms/msys2/REPOS/MINGW/i686/
## Sourceforge.net
Server = http://downloads.sourceforge.net/project/msys2/REPOS/MINGW/i686
## FutureAt 镜像
Server = http://www2.futureware.at/~nickoe/msys2-mirror/msys/i686/
## mirrorlist.mingw64
##
## 64-bit Mingw-w64 repository mirrorlist
##
## 清华大学软件镜像
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86\_64/
## 中科大镜像
Server = http://mirrors.ustc.edu.cn/msys2/mingw/x86\_64/
## msys2.org
Server = http://repo.msys2.org/mingw/x86\_64/
## Sourceforge 镜像
Server = https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86\_64/
## The UK Mirror Service Sourceforge mirror
Server = http://sourceforge.mirrorservice.org/m/ms/msys2/REPOS/MINGW/x86\_64/
## Sourceforge.net
Server = http://downloads.sourceforge.net/project/msys2/REPOS/MINGW/x86\_64
## FutureAt 镜像
Server = http://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/
## mirrorlist.msys
##
## MSYS2 repository mirrorlist
##
## 清华大学软件镜像
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch
## 中科大镜像
Server = http://mirrors.ustc.edu.cn/msys2/msys/$arch
## msys2.org
Server = http://repo.msys2.org/msys/$arch
## Sourceforge 镜像
Server = https://sourceforge.net/projects/msys2/files/REPOS/msys/$arch
## The UK Mirror Service Sourceforge mirror
Server = http://sourceforge.mirrorservice.org/m/ms/msys2/REPOS/msys/$arch
## Sourceforge.net
Server = http://downloads.sourceforge.net/project/msys2/REPOS/msys/$arch
## FutureAt 镜像
Server = http://www2.futureware.at/~nickoe/msys2-mirror/msys/$arch
pacman –Syuu
C:\\msys64>autorebase.bat
ReBaseImage (/usr/bin/msys-gnutls-30.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-intl-8.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-unistring-2.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-gpg-error-0.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-ffi-7.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-ksba-8.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-gcrypt-20.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-npth-0.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-p11-kit-0.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-idn2-0.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-iconv-2.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-tasn1-6.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-hogweed-6.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-gmp-10.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-assuan-0.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-nettle-8.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-gcc\_s-seh-1.dll) failed with last error = 2
The following DLLs couldn't be rebased because they were in use:
/usr/bin/msys-gnutls-30.dll
/usr/bin/msys-intl-8.dll
/usr/bin/msys-unistring-2.dll
/usr/bin/msys-gpg-error-0.dll
/usr/bin/msys-ffi-7.dll
/usr/bin/msys-ksba-8.dll
/usr/bin/msys-gcrypt-20.dll
/usr/bin/msys-npth-0.dll
/usr/bin/msys-p11-kit-0.dll
/usr/bin/msys-idn2-0.dll
/usr/bin/msys-iconv-2.dll
/usr/bin/msys-tasn1-6.dll
/usr/bin/msys-hogweed-6.dll
/usr/bin/msys-gmp-10.dll
/usr/bin/msys-assuan-0.dll
/usr/bin/msys-nettle-8.dll
/usr/bin/msys-gcc\_s-seh-1.dll
The following DLLs couldn't be rebased due to errors:
/usr/bin/msys-gnutls-30.dll
/usr/bin/msys-intl-8.dll
/usr/bin/msys-unistring-2.dll
/usr/bin/msys-gpg-error-0.dll
/usr/bin/msys-ffi-7.dll
/usr/bin/msys-ksba-8.dll
/usr/bin/msys-gcrypt-20.dll
/usr/bin/msys-npth-0.dll
/usr/bin/msys-p11-kit-0.dll
/usr/bin/msys-idn2-0.dll
/usr/bin/msys-iconv-2.dll
/usr/bin/msys-tasn1-6.dll
/usr/bin/msys-hogweed-6.dll
/usr/bin/msys-gmp-10.dll
/usr/bin/msys-assuan-0.dll
/usr/bin/msys-nettle-8.dll
/usr/bin/msys-gcc\_s-seh-1.dll
至此,MSYS2准备完毕。
先搜索一下:
pacman -Ss emacs
请根据您的操作系统的版本,选择安装相应的版本。
安装64版本:
pacman -S mingw-w64-x86\_64-emacs
安装32为版本:
pacman -S mingw-w64-i686-emacs
使用MSYS2子系统和gcc开源编译器,可以为window(7,8,10)编译安装Emacs。
对于高级用户,例如需要使用Emacs来支持pdf、图片、编程开发等功能的用户,推荐此种方案。
安装和准备MSYS2见前面一节的描述。
然后,安装emacs编译所需的软件包:
pacman -Sy --noconfirm base-devel git mingw-w64-x86\_64-{giflib,gnutls,jansson,zlib,lib{jpeg-turbo,png,rsvg,tiff,xml2},toolchain,xpm-nox}
要支持xwidget浏览器:(这里不使用)
pacman –Sy webkitgtk
为了简化安装,可以定义环境变量 BUILDDIR(存放二进制执行文件)、INSTALLDIR(存在安装目标文件路径)、SOURCEDIR(存放源文件)。注意:因为在MSYS2子系统中操作,所以路径名要用正斜杠(“/”)。下面的命令创建SOURCEDIR,运行autogen.sh脚本创建一个配置脚本。
SOURCEDIR=/var/git/emacs && mkdir -p $SOURCEDIR && cd $SOURCEDIR
git clone git://git.savannah.gnu.org/emacs.git . --depth=1
当前目录克隆Emacs项目。有一点不得不提,Gti自动改换行符的功能(autocrlf)很讨厌,下面的命令关掉它:
git config core.autocrlf false
./autogen.sh
上述步骤可以使用一个命令搞定:
SOURCEDIR=/var/git/emacs && mkdir -p $SOURCEDIR && cd $SOURCEDIR &&
git clone git://git.savannah.gnu.org/emacs.git . --depth=1 &&
./autogen.sh
SOURCEDIR=/var/git/emacs && cd $SOURCEDIR
git reset --hard HEAD
git fetch
git checkout origin/master
BUILDDIR=/d/emacs && rm -rf $BUILDDIR &>/dev/null
mkdir -p $BUILDDIR; cd $BUILDDIR
SOURCEDIR=/var/git/emacs && $SOURCEDIR/configure --without-dbus
--without-compress-install --with-modules 'CFLAGS=-O2 -g3'
可选项说明:
进行编译:
make
INSTALLDIR=/d/SoftTools/dev-tools/emacs && make install-strip prefix=$INSTALLDIR
上述步骤可以使用一个命令搞定:
SOURCEDIR=/var/git/emacs INSTALLDIR=/d/SoftTools/dev-tools/emacs BUILDDIR=/d/emacs && pushd $SOURCEDIR && git reset --hard HEAD && git fetch && git checkout origin/master && rm -rf $BUILDDIR &>/dev/null && mkdir -p $BUILDDIR; pushd $BUILDDIR && $SOURCEDIR/configure --without-dbus --without-compress-install --with-modules 'CFLAGS=-O2 -g3' && make –j4 && make install-strip prefix=$INSTALLDIR
如果已经安装了MSYS2,只需要重复这一步来更新emacs到最新版本。
安装完毕后,可通过命令查看配置特性和选项:
运行emacs,输入:
C-h v system-configuration-features
C-h v system-configuration-options
因为我们编译的时候用了很多由第三方库提供的功能, 所以我们编译的这个Emacs是需要那些DLL才能运行的。如果你的系统里面MSYS2已经被添加到PATH环境变量里(例如PATH里包含了C:\msys2\mingw64\bin)了,那这将不是问题,但如果环境变量里没有或者你想在其他电脑上用,需要用下面的命令复制所需的DLL到Emacs所在目录:
INSTALLDIR=c:/programs/emacs
cp /mingw64/bin/{zlib\\\*,lib{winpthread-\\\*,Xpm-noX\\\*,gomp-\\\*,gcc\\\_s\\\_seh-\\\*,glib-\\\*,intl-\\\*,iconv-\\\*,gobject-\\\*,ffi-\\\*,gio-\\\*,gmodule-\\\*,freetype-\\\*,pixman-\\\*,png\\\*,expat-\\\*,harfbuzz-\\\*,gnutls-\\\*,gnutlsxx-\\\*,tiff-\\\*,tiffxx-\\\*,jpeg-\\\*,gif-\\\*,bz2-\\\*,jbig-\\\*,gmp-\\\*,hogweed-\\\*,nettle-\\\*,p11-kit-\\\*,tasn1-\\\*}}.dll $INSTALLDIR/bin
注意:
1)windows、msys2下都有find命令,最好在emacs中配置可执行文件路径。
2)如果没有设置上述路径,不能支持SSL、图形处理等,因为它们依赖于支持库。
安装PDF Tools 和Xwidgets web browser 插件,具体操作,请见:
http://tuhdo.github.io/setup-emacs-windows.html
跟以前使用的 Emacs for MS Win64 一样,emacs 配置文件还是默认在C:/Users/AppData/Roaming/.emacs.d 中。大多数 package 放在本地c:/msys2/home/user/.emacs.d/elpa/yourdir/以后使用 (add-to-list 'exec-path “yourdir”) 即可正常调用。
对于 Windows 10, Windows 8, Windows 7, Windows Vista,默认加载的配置文件是以下二者之一:
也可以指定加载的配置文件:
%home%\\apps\\emacs-24.1\\bin\\runemacs.exe -q --load=%home%\\ErgoEmacs\_dev\\init.el --load=%home%\\.emacs
另外,可以在windows中设置环境变量HOME,使其不默认指向 %HOMEPATH%\AppData\Roaming\,但带来的负面影响是改变了msys2中的默认HOME目录。不建议采用。
这里以ubuntu 为例进行介绍。其安装方法有两种:
发行源仓库中的emcas一般是较新的稳定版本,而且linux的不同版本所安装的emacs版本也不相同。Ubuntu自身的安装源仓库的emacs版本较低,为了安装较新的emacs需要从其他发行源进行安装。
在ubuntu 1604上的安装如下:
sudo add-apt-repository ppa:ubuntu-elisp/ppa
sudo apt-get update
sudo apt-cache search emacs
sudo apt-get install emacs-snapshot emacs-snapshot-el
sudo add-apt-repository -r ppa:ubuntu-elisp/ppa
sudo apt-get update
说明,在不同的版本上,emacs的发行源仓库的地址可能会有所不同。例如,在ubuntu 1804上,其发行源为:ppa:kelleyk/emacs
可以使用源代码方式安装最新版本的emacs。
$ git clone http://repo.or.cz/r/emacs.git
$ tar xvzf emacs-25.1.tar.gz
$ sudo apt-get build-dep emacs24 xserver-xorg-dev xorg-dev lib64ncurses5 lib64ncurses5-dev libidl.dev libgtk-3-dev libgtk2.0-dev libgnutls-dev
$ sudo apt-get install libpng12-dev libjpeg-dev libtiff5-dev libgif-dev librsvg2-dev libxpm-dev
$ sudo apt-get install libncurses5-dev
安装libncurses5-dev是因为部分图形库依赖于它。
$ sudo apt-get install libm17n-dev libxml2-dev
说明:也可以使用aptitude安装,这样可以解决包依赖问题。
sudo aptitude install libgtk2.0-dev
sudo apt-get install webkitgetk
cd ~/emacs-<version>\*
$ ./autogen.sh
$ ./configure --prefix=/usr/local/emacs --enable-font-backend
--with-xft --with-freetype --with-x-toolkit=gtk
参数解释:
如果仅仅支持文本终端方式,可以使用:
./configure --without-x \[--prefix=/path/to/dir\]
如果支持xwidget,添加选项:
–with-xwidgets --with-x --with-modules
./make -j4
./src/emacs -Q
mkdir /usr/local/emacs
./sudo make install
./make clean
./make distclean
cd /usr/local/bin
sudo ln -s /usr/local/emacs/bin/\* ./
cd /usr/local/emacs/share/applications
把下面这个文件复制到
cp emacs.desktop /usr/share/applications/
之后注销重新登录一下就可以找到图标了
alias em=‘emacs’
1、交换Caplock和Control 键
放置下面的内容到shell 初始化文件(.bashrc或者.zshrc)中。
/usr/bin/setxkbmap -option “ctrl:swapcaps”
进一步的参考请见 http://askubuntu.com/a/412622/13847
根据用途的不同,可以按需进行Emacs配置,使其能够进行文本编辑、各种代码的编辑编译测试,以及安装或自开发扩展软件包并加以配置,实现随心所欲使用Emacs的目标。
下面个人Windows环境下的emacs配置文件,供参考。
.emacs.d\init.el文件内容如下:
;; Set repositories
(require 'package)
(setq-default
load-prefer-newer t
package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/") t)
;; (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
;; (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(package-initialize)
;; Install dependencies
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(setq-default
use-package-always-defer t
use-package-always-ensure t)
(setenv "PATH" (concat "C:\\msys64\\usr\\bin;C:\\msys64\\mingw64\\bin;" (getenv "PATH")))
(set-language-environment 'utf-8)
(setq locale-coding-system 'utf-8)
;; (set-default-coding-systems 'utf-8) ;使能该条,编辑中文时运行会很卡。
(set-terminal-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
;; this variables must be set before load custom setup files
(add-to-list 'load-path "~/.emacs.d/custom")
(require 'setup-face)
(require 'setup-editing)
.emacs.d\custom\setup-face.el文件内容如下:
;; Start maximised (cross-platf)
(add-hook 'window-setup-hook 'toggle-frame-maximized t)
(when window-system
(blink-cursor-mode 0) ; Disable the cursor blinking
(scroll-bar-mode 0) ; Disable the scroll bar
(tool-bar-mode 0) ; Disable the tool bar
(tooltip-mode 0)) ; Disable the tooltips
(setq-default
ad-redefinition-action 'accept ; Silence warnings for redefinition
confirm-kill-emacs 'yes-or-no-p ; Confirm before exiting Emacs
cursor-in-non-selected-windows t ; Hide the cursor in inactive windows
delete-by-moving-to-trash t ; Delete files to trash
display-time-default-load-average nil ; Don't display load average
display-time-format "%H:%M" ; Format the time string
fill-column 80 ; Set width for automatic line breaks
help-window-select t ; Focus new help windows when opened
indent-tabs-mode nil ; Stop using tabs to indent
inhibit-startup-screen t ; Disable start-up screen
initial-scratch-message "" ; Empty the initial *scratch* buffer
left-margin-width 1 right-margin-width 1 ; Add left and right margins
mode-require-final-newline 'visit ; Add a newline at EOF on visit
mouse-yank-at-point t ; Yank at point rather than pointer
ns-use-srgb-colorspace nil ; Don't use sRGB colors
recenter-positions '(5 top bottom) ; Set re-centering positions
redisplay-dont-pause t ; don't pause display on input
debug-on-error t
jit-lock-defer-time 0
frame-resize-pixelwise t
fast-but-imprecise-scrolling t
scroll-conservatively 10000 ; Always scroll by one line
scroll-margin 1 ; scroll N lines to screen edge
scroll-step 1 ; keyboard scroll one line at a time
scroll-preserve-screen-position 1
select-enable-clipboard t ; Merge system's and Emacs' clipboard
sentence-end-double-space nil ; End a sentence after a dot and a space
show-trailing-whitespace nil ; Display trailing whitespaces
split-height-threshold nil ; Disable vertical window splitting
split-width-threshold nil ; Disable horizontal window splitting
tab-width 4 ; Set width for tabs
uniquify-buffer-name-style 'forward ; Uniquify buffer names
window-combination-resize t ; Resize windows proportionally
x-stretch-cursor t) ; Stretch cursor to the glyph width
(delete-selection-mode) ; Replace region when inserting text
(setq line-number-mode t) ; Enable line numbers in the mode-line
(setq column-number-mode t) ; Enable column numbers in the mode-line
(size-indication-mode 1) ; Enable size status in the mode-line
(display-time-mode) ; Enable time in the mode-line
(fringe-mode 0) ; Hide fringes
(fset 'yes-or-no-p 'y-or-n-p) ; Replace yes/no prompts with y/n
(global-hl-line-mode) ; Hightlight current line
(show-paren-mode t)
;;(setq show-paren-style 'expression)
(global-subword-mode) ; Iterate through CamelCase words
(menu-bar-mode 0) ; Disable the menu bar
;(mouse-avoidance-mode 'banish) ; Avoid collision of mouse with point
(put 'downcase-region 'disabled nil) ; Enable downcase-region
(put 'upcase-region 'disabled nil) ; Enable upcase-region
(setq frame-title-format ;set the frame title name
'("" invocation-name " - " (:eval (if (buffer-file-name)
(abbreviate-file-name (buffer-file-name))
"%b"))))
;; customize fontset
(setq w32-charset-info-alist
(cons '("gbk" w32-charset-gb2312 . 936) w32-charset-info-alist))
(create-fontset-from-fontset-spec
"-outline-Source Code Pro-normal-normal-normal-mono-15-*-*-*-c-*-fontset-gbk")
(setq w32-enable-synthesized-fonts t) ; Enable bold and italic fonts
;; (set-face-font 'italic "-*-Source Code Pro-normal-i-*-*-15-*-*-*-c-*-fontset-gbk")
(set-face-font 'bold "-*-Source Code Pro-bold-*-*-*-15-*-*-*-c-*-fontset-gbk")
(set-fontset-font
"fontset-default" nil
"-outline-新宋体-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1" nil 'prepend)
(set-fontset-font
"fontset-gbk" 'kana
"-outline-新宋体-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1" nil 'prepend)
(set-fontset-font
"fontset-gbk" 'han
"-outline-新宋体-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1" nil 'prepend)
(set-fontset-font
"fontset-gbk" 'cjk-misc
"-outline-新宋体-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1" nil 'prepend)
(set-fontset-font
"fontset-gbk" 'symbol
"-outline-新宋体-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1" nil 'prepend)
(add-to-list 'default-frame-alist '(font . "fontset-gbk"))
(set-default-font "fontset-gbk")
;;(defvar mp/font-family "Consolas" "The font to use.")
(defvar mp/font-size-default 100 "The font size to use for default text.")
(defvar mp/font-size-header-line 100 "The font size to use for the header-line.")
(defvar mp/font-size-mode-line 90 "The font size to use for the mode-line.")
(defvar mp/font-size-title 100 "The font size to use for titles.")
(use-package solarized-theme
:demand t
:config
(load-theme 'solarized-wombat-dark t)
;; (load-theme 'solarized-dark t)
;; (load-theme 'solarized-light t)
(set-face-attribute 'font-lock-comment-face nil :italic t)
(set-face-attribute 'font-lock-doc-face nil :italic t)
;; (set-face-attribute 'default nil :height mp/font-size-default :font mp/font-family)
(set-face-attribute 'header-line nil :height mp/font-size-header-line)
(set-face-attribute 'mode-line nil :height mp/font-size-mode-line)
(set-face-attribute 'mode-line-inactive nil :height mp/font-size-mode-line)
;; make the modeline high contrast
(setq solarized-high-contrast-mode-line t)
;; make the fringe stand out from the background
(setq solarized-distinct-fringe-background t)
)
(provide 'setup-face)
.emacs.d\custom\setup-editing.el文件内容如下:
(add-hook 'focus-out-hook #'garbage-collect)
;; (setq-default custom-file (expand-file-name "custom.el" user-emacs-directory))
;; (when (file-exists-p custom-file)
;; (load custom-file))
;; (let ((secret.el (expand-file-name "secret.el" "~/emax/")))
;; (when (file-exists-p secret.el)
;; (load secret.el)))
;; (use-package mdi
;; :ensure nil
;; :load-path "~/emax/lisp/mdi/"
;; :after solarized-theme)
(global-set-key (kbd "M-o") 'other-window)
(global-set-key (kbd "RET") 'newline-and-indent)
;; (setq require-final-newline t)
;; (setq recentf-max-saved-items 2048)
;; (add-hook 'before-save-hook 'delete-trailing-whitespace)
;; (setq browse-url-browser-function 'browse-url-default-browser)
(defun choose-browser (url &rest args)
(interactive "sURL: ")
(if (y-or-n-p "Use external browser? ")
(browse-url-default-browser url)
(w3m-browse-url url)))
(setq browse-url-browser-function 'choose-browser)
;; define markdown transform program
(setq markdown-command "d:\\SoftTools\\dev-tools\\pandoc\\pandoc.exe")
;; Running Windows Powershell from within Emacs
; (setq explicit-shell-file-name "c:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe")
; (setq explicit-powershell.exe-args '("-Command" "-" )) ; interactive, but no command prompt
; (autoload 'powershell "powershell" "Run powershell as a shell within emacs." t)
;; (pdf-tools-install :no-query)
(provide 'setup-editing)
临时禁止校验签名:
(setq package-check-signature nil)
更新GPG kering
M-x package-install RET gnu-elpa-keyring-update RET
参考:http://elpa.gnu.org/packages/gnu-elpa-keyring-update.html
为了快捷,可以使用国内的镜像:
(setq package-archives '(
;; uncomment below line if you need use GNU ELPA ;;
;;("gnu" . "https://elpa.gnu.org/packages/")
;;("localelpa" . "~/.emacs.d/localelpa/")
;; ;; {{ 163 repository:
;; ("melpa" . "https://mirrors.163.com/elpa/melpa/")
;; ("melpa-stable" . "https://mirrors.163.com/elpa/melpa-stable/")
;; ;; }}
;; ;; {{ tinghua repository (more stable than 163, recommended)
;; ;;See https://mirror.tuna.tsinghua.edu.cn/help/elpa/ on usage:
;; ("gnu" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")
;;("melpa-stable" .
"http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa-stable/")
;; ;; ("org" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/org/")
;; }}
;;("melpa" . "https://melpa.org/packages/")
;;("melpa-stable" . "https://stable.melpa.org/packages/")
))
sudo vim /etc/apt/sources.list
替换为以下内容:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
执行更新:
sudo apt-get update
复损坏的软件包,尝试卸载出错的包,重新安装正确版本的:
sudo apt-get -f install
更新软件:
sudo apt-get upgrade
完!