% Created 2020-05-16 szo 11:44
% 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:org0b2daf7}
\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:org4d64f15}
\subsection{Melpa}
\label{sec:orgf52f758}
\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:org82cf836}
\begin{verbatim}
;;(package-initialize)
;;(require 'cask "~/.cask/cask.el")
;;(cask-initialize)
\end{verbatim}
\subsection{Plugin-ok betöltése}
\label{sec:org02c14b2}
\subsubsection{Neotree}
\label{sec:org4ca03d5}
\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:org126d17c}
\begin{verbatim}
(nyan-mode)
\end{verbatim}
\subsubsection{ORG-bullets}
\label{sec:org9b7f238}
\begin{verbatim}
(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
\end{verbatim}
\subsubsection{RTags}
\label{sec:org5ad39f9}
\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:org88efd45}
\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:org1836d65}
\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:orgda1573a}
\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:org7624d94}
\begin{verbatim}
;(eval-after-load 'flycheck
;  '(add-hook 'flycheck-mode-hook #'flycheck-clang-tidy-setup))
\end{verbatim}
\subsubsection{Cmake-ide}
\label{sec:orgb7818da}
\begin{verbatim}
(cmake-ide-setup)
\end{verbatim}
\subsubsection{Highlight beállítások}
\label{sec:org5fabe57}
\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:org6c3bc39}
\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:org5a57e58}
\subsection{Rtags}
\label{sec:orgd751007}
\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:org5604f01}
\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:org0dfa5ed}
\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:orgff40c6e}
\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:orgb37c877}
\subsection{Csomag változók}
\label{sec:org58cef41}
\subsection{Minibuffer}
\label{sec:org02014b7}
\begin{verbatim}
(setq minibuffer-completion-confirm nil)
\end{verbatim}
\subsection{Spellcheck}
\label{sec:org26abb08}
\begin{verbatim}
(setq ispell-local-dictionary "/home/balazs/.local/hu_HU.dic")
\end{verbatim}
\subsection{Téma betöltése}
\label{sec:org8723ae3}
\begin{verbatim}
;;(load-theme "humanoid-dark" t)
;;(add-hook 'after-init-hook (lambda () (load-theme "humanoid-dark")))
\end{verbatim}
\subsection{Org-mode}
\label{sec:orgc9bf67a}
\begin{verbatim}
(setq org-todo-keywords
   '((squence "TODO" "WAITING" "|" "DONE(!)")))
(setq org-highlight-latex-and-related '(latex script entities))
(setq org-src-fontify-natively t
    org-src-tab-acts-natively t
    org-confirm-babel-evaluate nil
    org-edit-src-content-indentation 0)
\end{verbatim}
\subsection{Teszt}
\label{sec:org4c9b86c}
\begin{verbatim}
;;(setq cmake-ide-build-dir "cmake-build-test")
(cd "~/CLionProjects/prog2/")
\end{verbatim}
\end{document}
