Reputation: 77
I have been having trouble in getting the files I have installed on GNU Emacs(through the package archive) to work. The files are properly installed, but don't seem to have any effect. Below is the package archives section of my .emacs file, which were added automatically when I installed the packages:
'(package-archives
(quote
(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "https://stable.melpa.org/packages/"))))
'(package-enable-at-startup t)
'(package-selected-packages
(quote
(company-ycmd flycheck-irony company-rtags company-irony company-irony-c-headers dash solarized-theme))))
The configuration section in the information section of the packages says for example for flycheck-irony, to include:
(eval-after-load 'flycheck
'(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
This appears nowhere in my .emacs file, causing me to wonder if I am missing something. Any help would be appreciated.
Upvotes: 0
Views: 1386
Reputation: 11
You can waste your whole productive time this way. Errors over erros in the new emacs. I havnt seen a such one in the past 40 years since the beginning!
The alternative is: Take a really working editor and pray for Stallman and his genial emacs.
(btw.: And for Ian Murdock too! We vlive in very serious circumstances!)
After 40 years of very good use: Since version 25 the emacs isn't usable anymore. And a lot other free software too! Mathematics (stochastics) says: It's impossible, that all this could be an hazard.
Seems, there are a bunch of people, which want to gall Stallman to death by hidden sabotage of emacs and it seems, there could be a lot of hidden enemies of free software, saboteurs and moles in the lines of free hackers themselves today ...
Im not the youngest anymore (in my higher(sic.) ninetiees!) and I've seen a lot in the whole world during my life and i say by experience and by the gaussian distribution: This accumulation of "errors" in free software-projects of the past decade isn't a hazard, it is the result of organised sabotage against the free-software-idea plus clinical-ill over-engineering plus a problem of the generation-change: There was a lot of serious, well educated mathematicians, which was developers too in the past - today we have only a bunch of crazy hackers and brain-ill "carrierists" and so the quality of software is changing dramatically to the bad side now ... a desaster in my eyes ... but im too old now, to pass this fight further ...
(Hella (nearly 97))
btw: there was (and is) a live completely without computers too - and it wasnt the worst time, if i remember ...
Upvotes: 1
Reputation: 4235
The main advantage of the package.el stuff is with the automation of the basic install of Emacs lisp packages. For many packages, all you need to do is install the package. However, for some packages, especially packages which need to add hooks to different modes or require the user to select advanced features or features which have alternatives which package.el cannot predict, especially choices based on user preferences, you will need to add init code in init.el or .emacs.
I've found the use-package package really useful for managing elisp packages.
Here is what I have in my init.el file to use use-package
(add-to-list 'package-archives `("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(setq use-package-verbose nil)
(eval-when-compile
(require 'use-package))
(require 'diminish)
(require 'bind-key)
Then I have use-package blocks for each of the packages I need. Some packages are very simple e.g.
(use-package undo-tree
:ensure t
:diminish undo-tree-mode
:config (global-undo-tree-mode))
use-package swiper
:ensure t
:bind ("C-s". swiper))
The :ensure key tells use-package to make sure it gets this package from an ELPA repository. There are other keys for things like pinning to a specific repository, doing setup before loading the package, after loading the package, adding to auto=mode-alist, binding keys, etc.
the really nice thing is that once you have all your use-package blocks defined in your init.el file, you can move that init.el file to any new machine and the first time you start emacs, it will automatically download all the packages you need. The other nice thing about use-package is that it will set things up to autoload packages. This can significantly speed up your emacs startup time. You can also use use-package to manage configuration of built-in features or manually installed elisp libraries. Really helps with managing your init.el file and makes it very easy to add/remove/debug problems because all the relevant code is in one place. It is also as powerful as you need. Here is my org-mode configuration. It isn't necessarily a great org configuration, but it does show how you can use use-package for more complex setups - my org mode is heavily configured/customized for my specific requirements.
(use-package org
:pin org
:ensure org-plus-contrib
:init
(setq org-catch-invisible-edits 'smart
org-ctrl-k-protect-subtree t
org-default-notes-file "~/Dropbox/org/notes.org"
org-directory "~/Dropbox/org"
org-ellipsis "…"
org-list-allow-alphabetical t
org-list-indent-offset 2
org-pretty-entities t
org-startup-align-all-tables t
org-startup-with-inline-images (display-graphic-p)
org-support-shift-select t)
(setq org-modules '(org-bibtex
org-crypt
org-docview
org-eww
org-info
org-irc
org-protocol))
(setq org-capture-templates
(quote
(("t" "todo" entry
(file "~/Dropbox/org/refile.org")
"* TODO %?\n\n %a"
:empty-lines-after 1 :clock-in t :clock-resume t)
("r" "respond" entry
(file "~/Dropbox/org/refile.org")
"* NEXT Respond to %:from on %:subject\n SCHEDULED: %t\n %a"
:empty-lines-after 1 :clock-in t :clock-resume t)
("n" "note" entry
(file "~/Dropbox/org/notes.org")
"* %? :NOTE:\n\n %a"
:empty-lines-after 1 :clock-in t :clock-resume t)
("j" "journal" entry
(file+datetree "~/Dropbox/org/journal.org")
"* %?\n "
:empty-lines-after 1 :clock-in t :clock-resume t)
("p" "phone" entry
(file "~/Dropbox/org/refile.org")
"* PHONE %? :PHONE:\n "
:empty-lines-after 1 :clock-in t :clock-resume t)
("m" "mail" entry
(file "~/Dropbox/org/refile.org")
"* MAIL from %:from on %:subject\n\n %a"
:empty-lines-after 1 :clock-in t :clock-resume t))))
(setq org-enforce-todo-checkbox-dependencies t
org-enforce-todo-dependencies t
org-log-done 'time
org-log-into-drawer t)
(setq org-todo-keywords
(quote
((sequence "TODO(t)"
"NEXT(n)"
"STARTED(s!)"
"DELEGATED(w@/!)"
"HOLD(h@/!)"
"|"
"CANCELLED(c@)"
"DONE(d!)"))))
(setq org-log-refile 'time
org-refile-allow-creating-parent-nodes 'confirm
org-refile-targets (quote ((nil :maxlevel . 5)
(org-agenda-files :maxlevel . 5)))
org-refile-use-outline-path (quote file))
(setq org-clock-in-resume t
org-clock-out-remove-zero-time-clocks t
org-clock-persist 'clock
org-time-clocksum-format '(:hours "%d" :require-hours t
:minutes ":%02d" :require-minutes t))
(setq org-agenda-files '("~/Dropbox/org")
org-agenda-remove-tags t)
(setq org-agenda-custom-commands
(quote
(("n" "Agenda and all TODO's"
((agenda "" nil)
(alltodo "" nil))
nil)
("wr" "Weekly Report"
((todo "DONE|CANCELLED"
((org-agenda-overriding-header "Completed and Cancelled : Last Week")))
(todo "STARTED|NEXT"
((org-agenda-overriding-header "WIP")))
(todo "HOLD|DELEGATED"
((org-agenda-overriding-header "On Hold and Delegated Tasks")))
(todo "TODO"
((org-agenda-overriding-header "Task Backlog"))))
nil nil))))
(setq org-src-tab-acts-natively t
org-hide-block-startup t)
(setq org-confirm-babel-evaluate nil
org-babel-noweb-wrap-start "«"
org-babel-noweb-wrap-end "»")
(setq org-babel-clojure-backend 'cider
org-babel-clojure-sync-nrepl-timeout 0)
(setq org-plantuml-jar-path (expand-file-name "~/.emacs.d/jars/plantuml.jar")
org-ditaa-jar-path (expand-file-name "~/.emacs.d/jars/ditaa.jar")
org-ditaa-eps-jar-path (expand-file-name "~/.emacs.d/jars/DitaaEps.jar"))
(setq org-export-backends '(ascii beamer html
latex texinfo
md odt org)
org-export-coding-system 'utf-8)
(setq org-latex-classes
'(("beamer"
"\\documentclass[presentation]{beamer}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("article"
"\\documentclass[12pt]{hitec}
[DEFAULT-PACKAGES]
[PACKAGES]
[NO-EXTRA]
\\settextfraction{0.95}\n"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("report"
"\\documentclass[11pt]{report}"
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("book"
"\\documentclass[11pt]{book}"
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("une-article"
"\\documentclass[a4paper,12pt]{scrartcl}
[DEFAULT-PACKAGES]
[PACKAGES]
\\usepackage[margin=1.5cm]{geometry}
[EXTRA]\n"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("une-logo"
"\\documentclass[a4paper,12pt]{scrartcl}
[DEFAULT-PACKAGES]
[PACKAGES]
\\usepackage[margin=1.5cm]{geometry}
[EXTRA]
\\definecolor{unegreen}{HTML}{7AB800}
\\definecolor{Black}{HTML}{000000}
\\definecolor{White}{HTML}{FFFFFF}
\\definecolor{dimgrey}{HTML}{696969}
\\makeatletter
\\def\\@maketitle{
\\noindent \\begin{minipage}[c][4cm][t]{\\linewidth}
\\colorbox{Black}{%
\\begin{minipage}[t][4cm][c]{4cm}
\\flushleft
\\includegraphics{~/.emacs.d/img/unelogo_medium.png}
\\end{minipage}}
\\colorbox{unegreen}{%
\\begin{minipage}[t][4cm][c]{13.5cm}
\\flushright
\\Large \\textbf{\\color{White}{\\@title}} \\\\
\\vspace{4pt}
\\small \\color{White}{\\@author} \\\\
\\small \\color{White}{\\@date}
\\end{minipage}}
\\end{minipage}}
\\makeatother\n"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("old-article" "\\documentclass[11pt]{article}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
)
(setq org-latex-hyperref-template
"\\hypersetup{pdfauthor={%a},
pdftitle={%t},
pdfkeywords={%k},
pdfsubject={%d},
pdfcreator={%c},
pdflang={%L},
colorlinks=true,
linkcolor=blue}")
(setq org-latex-listings t
org-latex-listings-options '(("basicstyle" "\\tiny")
("frame" "single")
("stringstyle" "\\color{orange}")
("commentstyle" "\\color{cyan}")
("keywordstyle" "\\color{blue}")
("showstringspaces" "false")
("breakatwhitespace" "false")
("breaklines" "true")))
(setq org-latex-pdf-process
'("lualatex -interaction nonstopmode -output-directory %o %f"
"lualatex -interaction nonstopmode -output-directory %o %f"
"lualatex -interaction nonstopmode -output-directory %o %f"))
(setq org-latex-packages-alist
'(("" "parskip")
("" "xcolor")
("" "listings")))
(setq org-html-checkbox-type 'unicode
org-html-html5-fancy t
org-html-doctype "html5")
(setq org-ascii-charset 'utf-8
org-ascii-text-width 79)
:config
(org-element-update-syntax)
(org-clock-persistence-insinuate)
(add-to-list 'org-structure-template-alist
'("p" "#+BEGIN_SRC python\n?\n#+END_SRC"
"<src lang=\"python\">\n?\n</src>"))
(add-to-list 'org-structure-template-alist
'("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC"
"<src lang=\"emacs-lisp\">\n?\n</src>"))
(add-to-list 'org-structure-template-alist
'("cl" "#+BEGIN_SRC clojure-mode\n?\n#+END_SRC"
"<src lang=\"clojure-mode\">\n?\n</src>"))
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(clojure . t)
(css . t)
(dot . t)
(java . t)
(js . t)
(latex . t)
(ledger . t)
(makefile . t)
(org . t)
(perl . t)
(python . t)
(ruby . t)
(scheme . t)
(shell . t)
(sql . t)
(C . t)
(ditaa . t)
(plantuml . t)))
(when *is-a-mac*
(use-package org-mac-link
:ensure t
:bind (:map org-mode-map
("C-c g" . org-mac-grab-link))))
(bind-key "C-c l" 'org-store-link)
(bind-key "C-c a" 'org-agenda)
(bind-key "C-c b" 'org-switchb)
(bind-key "C-c r" 'org-capture))
Upvotes: 2