Emacs personal configuration
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

91 rinda
3.0KB

  1. ;;; Find and load the correct package.el
  2. ;; When switching between Emacs 23 and 24, we always use the bundled package.el in Emacs 24
  3. (let ((package-el-site-lisp-dir
  4. (expand-file-name "site-lisp/package" user-emacs-directory)))
  5. (when (and (file-directory-p package-el-site-lisp-dir)
  6. (> emacs-major-version 23))
  7. (message "Removing local package.el from load-path to avoid shadowing bundled version")
  8. (setq load-path (remove package-el-site-lisp-dir load-path))))
  9. (require 'package)
  10. ;;; Standard package repositories
  11. ;(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
  12. ;; We include the org repository for completeness, but don't normally
  13. ;; use it.
  14. (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
  15. (when (< emacs-major-version 24)
  16. (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
  17. ;;; Also use Melpa for most packages
  18. (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
  19. (add-to-list 'package-archives '("melpa-stable" . "http://melpa-stable.milkbox.net/packages/"))
  20. ;; If gpg cannot be found, signature checking will fail, so we
  21. ;; conditionally enable it according to whether gpg is available. We
  22. ;; re-run this check once $PATH has been configured
  23. (defun sanityinc/package-maybe-enable-signatures ()
  24. (setq package-check-signature (when (executable-find "gpg") 'allow-unsigned)))
  25. (sanityinc/package-maybe-enable-signatures)
  26. ;;(after-load 'init-exec-path
  27. ;; (sanityinc/package-maybe-enable-signatures))
  28. ;;; On-demand installation of packages
  29. (defun require-package (package &optional min-version no-refresh)
  30. "Install given PACKAGE, optionally requiring MIN-VERSION.
  31. If NO-REFRESH is non-nil, the available package lists will not be
  32. re-downloaded in order to locate PACKAGE."
  33. (if (package-installed-p package min-version)
  34. t
  35. (if (or (assoc package package-archive-contents) no-refresh)
  36. (package-install package)
  37. (progn
  38. (package-refresh-contents)
  39. (require-package package min-version t)))))
  40. ;;; Fire up package.el
  41. (setq package-enable-at-startup nil)
  42. (package-initialize)
  43. (require-package 'fullframe)
  44. (fullframe list-packages quit-window)
  45. (require-package 'cl-lib)
  46. (require 'cl-lib)
  47. (defun sanityinc/set-tabulated-list-column-width (col-name width)
  48. "Set any column with name COL-NAME to the given WIDTH."
  49. (cl-loop for column across tabulated-list-format
  50. when (string= col-name (car column))
  51. do (setf (elt column 1) width)))
  52. (defun sanityinc/maybe-widen-package-menu-columns ()
  53. "Widen some columns of the package menu table to avoid truncation."
  54. (when (boundp 'tabulated-list-format)
  55. (sanityinc/set-tabulated-list-column-width "Version" 13)
  56. (let ((longest-archive-name (apply 'max (mapcar 'length (mapcar 'car package-archives)))))
  57. (sanityinc/set-tabulated-list-column-width "Archive" longest-archive-name))))
  58. (add-hook 'package-menu-mode-hook 'sanityinc/maybe-widen-package-menu-columns)
  59. (provide 'init-elpa)