emacs-config/conf.tex~
2020-05-28 11:49:19 +02:00

286 lines
9.2 KiB
TeX

% Created 2020-05-16 szo 11:42
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\date{\today}
\title{Emacs konfiguráció}
\hypersetup{
pdfauthor={},
pdftitle={Emacs konfiguráció},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 26.3 (Org mode 9.1.9)},
pdflang={English}}
\begin{document}
\maketitle
\tableofcontents
\section{Preferenciák beállítása}
\label{sec:org0ed427f}
\begin{verbatim}
(add-to-list 'default-frame-alist
'(font . "Hack 11"))
(setq visible-bell 1)
(setq inhibit-startup-screen t)
(setq debug-on-error t)
\end{verbatim}
\section{Csomagok betöltése}
\label{sec:org94b202e}
\subsection{Melpa}
\label{sec:org9904051}
\begin{verbatim}
;;(require 'init-security)
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
)
(package-initialize)
(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.
;;'(custom-enabled-themes 'doom-solarized-dark)
'(package-selected-packages
(quote
(nyan-mode neotree flycheck))))
;;(custom-set-faces
;; custom-set-faces 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.
;; )
\end{verbatim}
\subsection{Cask}
\label{sec:orgadfc1bf}
\begin{verbatim}
;;(package-initialize)
;;(require 'cask "~/.cask/cask.el")
;;(cask-initialize)
\end{verbatim}
\subsection{Plugin-ok betöltése}
\label{sec:org2673c1f}
\subsubsection{Neotree}
\label{sec:orga4712c8}
\begin{verbatim}
;;(add-to-list 'load-path "/some/path/neotree")
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)
\end{verbatim}
\subsubsection{Nyan-mode}
\label{sec:orgcd19db7}
\begin{verbatim}
(nyan-mode)
\end{verbatim}
\subsubsection{ORG-bullets}
\label{sec:orgc8cca22}
\begin{verbatim}
(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
\end{verbatim}
\subsubsection{RTags}
\label{sec:org4727339}
\begin{verbatim}
(require 'rtags)
(require 'company-rtags)
(setq rtags-completions-enabled t)
(eval-after-load 'company
'(add-to-list
'company-backends 'company-rtags))
(setq rtags-autostart-diagnostics t)
(rtags-enable-standard-keybindings)
\end{verbatim}
\subsubsection{Irony-mode}
\label{sec:org9f562cb}
\begin{verbatim}
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)
(defun my-irony-mode-hook ()
(define-key irony-mode-map [remap completion-at-point]
'irony-completion-at-point-async)
(define-key irony-mode-map [remap complete-symbol]
'irony-completion-at-point-async))
(add-hook 'irony-mode-hook 'my-irony-mode-hook)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
\end{verbatim}
\subsubsection{Comany-irony}
\label{sec:org12df460}
\begin{verbatim}
(add-hook 'irony-mode-hook 'company-irony-setup-begin-commands)
(setq company-backends (delete 'company-semantic company-backends))
(eval-after-load 'company
'(add-to-list
'company-backends 'company-irony))
(setq company-idle-delay 0)
(define-key c-mode-map [(tab)] 'company-complete)
(define-key c++-mode-map [(tab)] 'company-complete)
\end{verbatim}
\subsubsection{Flycheck}
\label{sec:orga25d757}
\begin{verbatim}
(add-hook 'c++-mode-hook 'flycheck-mode)
(add-hook 'c-mode-hook 'flycheck-mode)
(require 'flycheck-rtags)
(defun my-flycheck-rtags-setup ()
(flycheck-select-checker 'rtags)
(setq-local flycheck-highlighting-mode nil) ;; RTags creates more accurate overlays.
(setq-local flycheck-check-syntax-automatically nil))
;; c-mode-common-hook is also called by c++-mode
(add-hook 'c-mode-common-hook #'my-flycheck-rtags-setup)
;;Integrate to irony
(eval-after-load 'flycheck
'(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
\end{verbatim}
\subsubsection{Flycheck-clang-tidy}
\label{sec:org16204a3}
\begin{verbatim}
;(eval-after-load 'flycheck
; '(add-hook 'flycheck-mode-hook #'flycheck-clang-tidy-setup))
\end{verbatim}
\subsubsection{Cmake-ide}
\label{sec:org8e2f8af}
\begin{verbatim}
(cmake-ide-setup)
\end{verbatim}
\subsubsection{Highlight beállítások}
\label{sec:org1bcf06d}
\begin{verbatim}
(add-hook 'irony-mode-hook 'highlight-numbers-mode)
(add-hook 'irony-mode-hook 'preproc-font-lock-mode)
\end{verbatim}
\subsubsection{Srefactor}
\label{sec:org8983e67}
\begin{verbatim}
(require 'srefactor)
(require 'srefactor-lisp)
;; OPTIONAL: ADD IT ONLY IF YOU USE C/C++.
(semantic-mode 1) ;; -> this is optional for Lisp
(define-key c-mode-map (kbd "M-RET") 'srefactor-refactor-at-point)
(define-key c++-mode-map (kbd "M-RET") 'srefactor-refactor-at-point)
(global-set-key (kbd "M-RET o") 'srefactor-lisp-one-line)
(global-set-key (kbd "M-RET m") 'srefactor-lisp-format-sexp)
(global-set-key (kbd "M-RET d") 'srefactor-lisp-format-defun)
(global-set-key (kbd "M-RET b") 'srefactor-lisp-format-buffer)
\end{verbatim}
\section{Makró beállítások}
\label{sec:orgbdb35ae}
\subsection{Rtags}
\label{sec:org32e4fcb}
\begin{verbatim}
(define-key c-mode-base-map (kbd "M-.") (function rtags-find-symbol-at-point))
(define-key c-mode-base-map (kbd "M-,") (function rtags-find-references-at-point))
(define-key c-mode-base-map (kbd "M-;") (function rtags-find-file))
(define-key c-mode-base-map (kbd "C-.") (function rtags-find-symbol))
(define-key c-mode-base-map (kbd "C-,") (function rtags-find-references))
(define-key c-mode-base-map (kbd "C-<") (function rtags-find-virtuals-at-point))
(define-key c-mode-base-map (kbd "M-i") (function rtags-imenu))
\end{verbatim}
\subsection{Open config}
\label{sec:orge673c0d}
\begin{verbatim}
(global-set-key (kbd "C-c o") (lambda () (interactive)
(find-file "/home/balazs/.emacs.d/conf.org")
(message "Opened: %s" (buffer-name))))
(global-set-key (kbd "C-c r") (lambda () (interactive)
(kill-buffer (buffer-name))
(load-file "/home/balazs/.emacs.d/init.el")
(message "Configuration reloaded")
))
\end{verbatim}
\subsection{Cmake build and run}
\label{sec:org95b8e59}
\begin{verbatim}
(defun cmake-build-and-run ()
"Asks for cmake target, then compiles and runs it."
(interactive)
(let ((target
(ido-completing-read "Choose build target: " (remove "" (split-string
(shell-command-to-string "cmake --build ./cmake-build-debug --target help | awk '{if($2 != \"all\" && $2!= \"clean\" && $2 != \"following\" && $2 != \"edit_cache\" && $2 != \"rebuild_cache\" && $2 != \"depend\" && $2 !~ /\\./){print $2}}'") "\n")))))
(setq cmake-last-target target)
(async-shell-command (format "cmake --build ./cmake-build-debug --target %s && ./cmake-build-debug/%s" target target))))
(defun cmake-build-last-target ()
(interactive)
(if (not (null cmake-last-target))
(async-shell-command (format "cmake --build ./cmake-build-debug --target %s && ./cmake-build-debug/%s" cmake-last-target cmake-last-target))
(cmake-build-and-run))
)
(define-key c-mode-base-map (kbd "C-c C-r") (function cmake-build-and-run))
(define-key c-mode-base-map [f5] 'cmake-build-last-target)
\end{verbatim}
\subsection{Kód indentálás}
\label{sec:org1ea9043}
\begin{verbatim}
(defun indent-buffer ()
(interactive)
(save-excursion
(indent-region (point-min) (point-max) nil)))
(global-set-key [f6] 'indent-buffer)
\end{verbatim}
\section{Saját változók}
\label{sec:org3ba5035}
\subsection{Csomag változók}
\label{sec:orgb352463}
\subsection{Minibuffer}
\label{sec:orge617b53}
\begin{verbatim}
(setq minibuffer-completion-confirm nil)
\end{verbatim}
\subsection{Spellcheck}
\label{sec:org898ac88}
\begin{verbatim}
(setq ispell-local-dictionary "/home/balazs/.local/hu_HU.dic")
\end{verbatim}
\subsection{Téma betöltése}
\label{sec:org9ad924f}
\begin{verbatim}
;;(load-theme "humanoid-dark" t)
;;(add-hook 'after-init-hook (lambda () (load-theme "humanoid-dark")))
\end{verbatim}
\subsection{Org-mode}
\label{sec:org4cc28e6}
\begin{verbatim}
(setq org-todo-keywords
'((squence "TODO" "WAITING" "|" "DONE(!)")))
(setq org-highlight-latex-and-related '(latex script entities))
\end{verbatim}
\subsection{Teszt}
\label{sec:org1e32ad2}
\begin{verbatim}
;;(setq cmake-ide-build-dir "cmake-build-test")
(cd "~/CLionProjects/prog2/")
\end{verbatim}
\end{document}