Emacs에서 패키지 업데이트
패키지에 대해 다음 설정이 있습니다 (더 나은 권장 패키지가 있는지 확실하지 않음).
(require 'package)
(setq package-archives '(("ELPA" . "http://tromey.com/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")))
; Apparently needed for the package auto-complete (why?)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(setq url-http-attempt-keepalives nil)
패키지 설치 및 업데이트와 관련된 세 가지 질문이 있습니다.
Q1. 사용 가능한 패키지 목록 (및 최신 버전)을 업데이트하고 특정 패키지를 업데이트하는 방법이 있습니까?
Q.2 다음 패키지 소스의 차이점은 무엇입니까?
- ELPA,
- 암소 비슷한 일종의 영양
- 마멀레이드
- 멜파
Q.3 추가되는 순서가 중요합니까 package-archives
?
패키지 목록을 자동으로 업데이트하려면 패키지 목록이없는 경우에만 다음을 사용하십시오.
(when (not package-archive-contents) (package-refresh-contents))
설치된 모든 패키지를 업데이트하려면을 입력하십시오
package-list-packages
. 그러면*Packages*
버퍼로 이동하고 패키지 목록도 업데이트 U x됩니다.package-refresh-contents
무조건 추가 한 모든 저장소에서 패키지 목록을 다운로드하려고 시도합니다package-archives
.package-archive-contents
이미 패키지 목록을 다운로드 한 경우 0이 아닙니다.ELPA 는 원본입니다. 더 이상 실제로 유지되지 않는다고 생각하지만 확실하지 않습니다. 나는 그것을 사용하지 않습니다.
GNU 는 "공식"입니다. Emacs와 함께 유지 관리되므로 항상 작동하지만 업데이트 및 새 패키지가 자주 나오지 않습니다.
마멀레이드 는 기본적으로 완전한 패키지를 업로드 할 수있는 웹 사이트이며 마멀레이드 리포지토리에 추가됩니다. 패키지의 업스트림에 대한 링크를 제출하지 않고 패키지 작성을 완전히 자동화하지는 않습니다. 업스트림을 추적하고 싶지는 않기 때문에 이것이 올바른 것이라고 생각합니다. 불행히도, 그것은 오랫동안 유지되지 않았지만 누군가가 최근에 그것을 인수하여 어느 시점에서 다시 돌아와야합니다.
Melpa 는 EmacsWiki lisp 영역 또는 github 저장소와 같은 URL을 가져 와서 자동으로 패키지를 빌드합니다. 따라서 추적하는 것이 무엇이든 대개 하루가 지납니다. 그것은 업스트림을 추적하지만 실제로 문제는 없었으며, 이것이 대부분의 패키지가 나온 곳입니다. Melpa Stable 도 Melpa 와 비슷하지만 최신 개정판 대신 업스트림 저장소의 태그 개정판을 가져옵니다. Melpa 안정은 Melpa보다 패키지가 적습니다.
조직 모드 에는 자체
package.el
저장소가 있습니다 ( http://orgmode.org/elpa/ ).모든 패키지 저장소는 동일하게 작동합니다
package-archives
.다음 은이 주제에 대한 보다 심도 깊은 블로그 게시물 입니다.
확실하지 않지만 패키지가 다른 저장소에 복제되면 저장소가 표시되는 순서가
package-archives
우선 순위 를 결정합니다. 높은 우선 순위가 목록의 시작 또는 끝에 있는지 모르겠습니다.업데이트 : Emacs 25에는
package-archive-priorities
패키지 저장소의 우선 순위를 정하는 데 사용할 수 있는 변수 가 있습니다 (예 : ELPA보다 MELPA 선호).
init.el
관심있는 경우 내 관련 섹션은 다음과 같습니다 .
(setq jpk-packages
'(
ac-dabbrev
...
yasnippet
))
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives
'("org" . "http://orgmode.org/elpa/"))
;; install any packages in jpk-packages, if they are not installed already
(let ((refreshed nil))
(when (not package-archive-contents)
(package-refresh-contents)
(setq refreshed t))
(dolist (pkg jpk-packages)
(when (and (not (package-installed-p pkg))
(assoc pkg package-archive-contents))
(unless refreshed
(package-refresh-contents)
(setq refreshed t))
(package-install pkg))))
(defun package-list-unaccounted-packages ()
"Like `package-list-packages', but shows only the packages that
are installed and are not in `jpk-packages'. Useful for
cleaning out unwanted packages."
(interactive)
(package-show-package-list
(remove-if-not (lambda (x) (and (not (memq x jpk-packages))
(not (package-built-in-p x))
(package-installed-p x)))
(mapcar 'car package-archive-contents))))
Emacs 내 M-x list-packages
에서 아카이브 내용을 자동으로 새로 고칠 모든 패키지를 나열 하는 데 사용 하십시오. 그런 다음 U
업그레이드 가능한 모든 패키지를 업그레이드하도록 표시 x
하고 실제로 새 업데이트를 수행합니다. 그러면 Emacs는 모든 업그레이드를 가져 와서 설치 한 다음, 더 이상 사용되지 않는 이전 버전을 제거 할 것인지 묻습니다.
You may also want to take a look at Carton which provides a more convenient way to manage your packages by declaring them in a dedicated file, and includes a convenient command line client to automatically install and upgrade packages declared in this way.
The order of package-archives
does not matter. Emacs aggregates the contents of all archives into a single coherent list of available packages and their versions, stored in package-archive-contents
.
Upon package-install
, Emacs will simply pick the newest version of a package, regardless of the originating archive. For more control about package origin, MELPA provides the melpa package which allows to black- or whitelist packages from specified archives.
In terminal:
emacs
M-x list-packages
this puts you in the *packages* buffer
shift-u x
emacs will ask you (y/n), wait for updates
C-x k <ret>
this will kill the *packages* buffer and return you back to *scratch*
C-x-C-c
this will exit emacs, and let you relaunch via, but you might have to debug :(
emacs
my 2¢
This is more of an extended comment on jpkotta's answer.
This is an adjustment I am experimenting with for jpkotta's answer above:
(setq n 0) ; set n as 0
(dolist (pkg pkgs-2b-present) ; for each pkg in list
(unless (or ; unless
(package-installed-p pkg) ; pkg is installed or
(assoc pkg ; pkg is in the archive list
package-archive-contents))
(setq n (+ n 1)))) ; add one to n
(when (> n 0) ; if n > 0,
(package-refresh-contents)) ; refresh packages
(replacing (when (not package-archive-contents) (package-refresh-contents))
).
The package-list was not refreshing sufficiently often enough for my use-case.
I haven't considered if there is a more efficient solution to my problem; first, I've to see if the problem goes away with this adjustment.
참고URL : https://stackoverflow.com/questions/14836958/updating-packages-in-emacs
'Programing' 카테고리의 다른 글
같은 클래스에서 두 개의 메소드를 동기화하면 동시에 실행할 수 있습니까? (0) | 2020.06.25 |
---|---|
django-rest-framework의 관리자 스타일 탐색 가능한 인터페이스를 비활성화하는 방법은 무엇입니까? (0) | 2020.06.25 |
Object.create (null)로 JS 객체를 생성합니까? (0) | 2020.06.25 |
iPhone SDK : loadView와 viewDidLoad의 차이점은 무엇입니까? (0) | 2020.06.25 |
bash 스크립트에서 조건을 무효화 (0) | 2020.06.25 |