(require 'helpers1)
(require 'help+)
(require 'mykeymaps)
(require 'hydra-ox)
(setq avy-keys '( ?1 ?2 ?3 ?4 ?5 ?q ?w ?e ?r ?t ?a ?s ?d ?f ?x ?c))
(setq avy-all-windows nil)
(require 'helper-hydras)
(require 'rect)
(eval-after-load "dired" '(progn (define-key dired-mode-map "." 'hydra-dired/body)))
;; (add-to-list 'custom-theme-load-path "~/.emacs.d/themes/solarized")
(add-to-list 'default-frame-alist '(font . "Terminus-10" ))
(set-face-attribute 'default t :font "TERMINUS-10" )
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(select-frame frame)
(load-theme 'zenburn t)
)
)
(load-theme 'zenburn t)
)
(show-paren-mode 2)
(setq show-paren-style 'parenthesis) ; highlight brackets
(setq show-paren-style 'expression) ; highlight entire expression
(global-linum-mode 1)
(setq linum-format "%4d ") ;; no line
(setq nlinum-highlight-current-line t)
(line-number-mode 1) ; have line numbers and
(column-number-mode 1) ; column numbers in the mode line
(require 'powerline)
(setq powerline-arrow-shape 'arrow14) ;; best for small fonts
(setq ag-highlight-search t)
(setq case-fold-search t) ;; case insensitive search
(setq org-src-fontify-natively t)
(require ‘org-bullets) (add-hook ‘org-mode-hook (lambda () (org-bullets-mode 1)))
;; (setq org-enforce-todo-dependencies t)
;; (setq org-enforce-todo-checkbox-dependencies t)
;; (add-to-list 'org-drawers "CLOCKING")
;; (add-to-list 'org-drawers "LOGBOOK")
(setq org-cycle-separator-lines 0)
(setq org-track-ordered-property-with-tag t)
(setq org-clock-into-drawer "CLOCKING")
(setq org-agenda-view-columns-initially t)
(setq org-startup-indented t)
(setq org-goto-interface 'outline-path-completion)
(setq org-outline-path-complete-in-steps nil)
(auto-fill-mode)
;; org-cycle-separator-lines
(setq org-adapt-indentation t)
(setq org-capture-templates (quote
(("t" "Todo" entry
(file+headline "~/org/general.org" "Tasks")
(file "~/org/templates/todo")
:empty-lines-after 1)
("b" "Book" entry
(file+headline "~/org/general.org" "Books")
(file "~/org/templates/book")
:empty-lines-after 1)
("g" "General note" entry
(file+headline "~/org/general.org" "Capture")
(file "~/org/templates/general")
:empty-lines-after 1))))
(setq org-agenda-files (quote ("~/org")))
(setq-default c-basic-offset 4)
(setq c-default-style "linux" c-basic-offset 4)
(setq tab-always-indent 't )
(setq browse-url-browser-function 'eww-browse-url)
(when (executable-find "curl")
(setq helm-google-suggest-use-curl-p t))
(setq helm-google-idle-delay 0.2)
;; into one dir
(setq backup-directory-alist '(("" . "~/.emacs.d/emacs-backup")))
;; (setq make-backup-files nil) ; stop creating backup~ files
;; (setq auto-save-default nil) ; stop creating #autosave# files
;; ;disable backup
;; (setq backup-inhibited t)
;; ;disable auto save
;; (setq auto-save-default nil)
(delete-selection-mode 1)
;; Mouse support:
(require 'mouse)
(xterm-mouse-mode 1)
(defadvice keyboard-escape-quit (around my-keyboard-escape-quit activate)
(let (orig-one-window-p)
(fset 'orig-one-window-p (symbol-function 'one-window-p))
(fset 'one-window-p (lambda (&optional nomini all-frames) t))
(unwind-protect
ad-do-it
(fset 'one-window-p (symbol-function 'orig-one-window-p)))))
(require 'xclip)
(xclip-mode 1)
(setq x-select-enable-clipboard t) ;; Ctrl+c in Linux X11
(setq x-select-enable-primary t) ;;selection in X11
(defhydra helper-hydra-settings (:color blue :hint nil)
"
^Settings^
--------------------------------------------
Edit: Reload:
_1_: settings.org _x_modmap and keyboard
_2_: helpers1.el
_3_: helper-hydras.el
_4_: keymaps
_o_: openbox rc.xml _<f2>_:emacs
_z_: ~/.zshrc
_s_: ~/scripts
_g_: general
"
("1" ((lambda () (interactive) (find-file "~/.emacs.d/settings.org"))))
("2" ((lambda () (interactive) (find-file "~/.emacs.d/manual-packages/helpers1.el"))))
("3" ((lambda () (interactive) (find-file "~/.emacs.d/manual-packages/helper-hydras.el"))))
("4" ((lambda () (interactive) (find-file "~/.emacs.d/manual-packages/mykeymaps.el"))))
("o" ((lambda () (interactive) (find-file "~/.config/openbox/rc.xml"))))
("z" ((lambda () (interactive) (find-file "~/.zshrc"))))
("g" ((lambda () (interactive) (find-file "~/org/general.org"))))
("s" ((lambda () (interactive) (helm-find-files "~/scripts/"))))
("x" (lambda () (interactive) (shell-command "keyboard_config.sh" ) ) )
("<f2>" helper-reload-settings)
)
(defun org-agenda-show-tags-in-columns (&optional arg)
(interactive "P")
(org-agenda arg "t"))
(defhydra helper-hydra-org-utils (:color blue)
("1" my/copy-id-to-clipboard "Copy headline ID")
("c" org-capture "Capture note")
("I" my/org-add-ids-to-headlines-in-file "ID all headlines")
("T" org-agenda-show-tags-in-columns "Agenda tags")
("j" org-adjust-region "Adjust list in region"))
(defhydra helper-hydra-web-search (:color blue)
("s" org-adjust-region "searx"))
(require 'helm)
(require 'helm-config)
;; xref
(require 'helm-xref)
(setq xref-show-xrefs-function 'helm-xref-show-xrefs)
;; gtags
(require 'helm-gtags)
;; Enable helm-gtags-mode
(add-hook 'dired-mode-hook 'helm-gtags-mode)
(add-hook 'eshell-mode-hook 'helm-gtags-mode)
(add-hook 'c-mode-hook 'helm-gtags-mode)
(add-hook 'c++-mode-hook 'helm-gtags-mode)
(add-hook 'asm-mode-hook 'helm-gtags-mode)
(setq
helm-gtags-ignore-case t
helm-gtags-auto-update t
helm-gtags-use-input-at-cursor t
helm-gtags-pulse-at-cursor t
helm-gtags-prefix-key "C-+"
helm-gtags-suggested-key-mapping t
)
;; helm
;; (global-unset-key (kbd "C-x c"))
(global-set-key (kbd "<f7>") 'helm-command-prefix) ;; menu key
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB work in terminal
(define-key helm-map (kbd "C-z") 'helm-select-action) ; list actions using C-z
(global-set-key (kbd "M-x") 'helm-M-x)
(setq helm-autoresize-max-height 30)
(setq helm-autoresize-min-height 30)
(setq helm-split-window-in-side-p t ; open helm buffer inside current window, not occupy whole other window
helm-move-to-line-cycle-in-source t ; move to end or beginning of source when reaching top or bottom of source.
helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp.
helm-scroll-amount 4 ; scroll 8 lines other window using M-<next>/M-<prior>
helm-ff-file-name-history-use-recentf t
helm-echo-input-in-header-line t)
(helm-autoresize-mode 1)
(helm-mode 1)
(setq undo-tree-auto-save-history t)
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))
(global-undo-tree-mode)
(require 'savehist)
(add-to-list 'savehist-additional-variables 'helm-dired-history-variable)
(savehist-mode 1)
(setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
(save-place-mode 1)
(require 'recentf)
(setq recentf-max-saved-items 1200)
(setq recentf-max-menu-items 150)
(setq recentf-auto-cleanup 'never)
(recentf-mode 1)
(run-at-time (current-time) 200 (let ((inhibit-message t)) 'recentf-save-list))
(global-fasd-mode 1)
(setq fasd-enable-initial-prompt nil)
;; (which-key-mode)
(require 'yasnippet)
(add-to-list 'load-path "~/.emacs.d/manual-packages/yasnippet")
(yas-global-mode 1)
;; (define-key yas-minor-mode-map (kbd "SPC") yas-maybe-expand)
(require 'autopair)
(autopair-global-mode) ;; enable autopair in all buffers
(autopair-mode)
;; (ac-config-default)
;; (setq ac-auto-show-menu 0.1)
;; (setq ac-delay 0.1)
;; (setq ac-menu-height 20)
;; (setq ac-auto-start t)
;; (setq ac-show-menu-immediately-on-auto-complete t)
;; (add-hook 'after-init-hook 'global-company-mode) ;
;; (add-to-list 'ac-modes 'org-mode)
;; (global-auto-complete-mode t)
;; (set-default 'semantic-case-fold t)
;; (add-hook 'after-init-hook 'global-company-mode)
;; (add-hook 'c++-mode-hook 'irony-mode)
;; (add-hook 'c-mode-hook 'irony-mode)
;; (add-hook 'objc-mode-hook 'irony-mode)
;; (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
;;
;; (setq company-dabbrev-downcase 0)
;; (setq company-idle-delay 0.1)
;; (eval-after-load 'company
;; '(progn
;; (define-key company-active-map (kbd "TAB") 'company-select-next)
;; (define-key company-active-map [tab] 'company-select-next)))
(require 'cc-mode)
(require 'semantic)
;; semantic-add-system-include
;; semanticdb-create-ebrowse-database
;; (semanticdb-default-system-save-directory)
;; (semanticdb-default-save-directory nil)
;; semanticdb-project-roots
;; (semantic-add-system-include)
;; semantic-dependency-system-include-path
;; (semantic-add-system-include "")
(global-semanticdb-minor-mode 1)
;; (global-semantic-idle-completions-mode 1)
(global-semantic-idle-scheduler-mode 1)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
(setq-local eldoc-documentation-function #'ggtags-eldoc-function)
;; ( semantic-add-system-include )
(add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
(semantic-mode 1)
(require 'stickyfunc-enhance)
(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(setq company-dabbrev-downcase 0)
(setq company-idle-delay 0.1)
(setq company-minimum-prefix-length 1)
(setq company-show-numbers t)
(setq company-dabbrev-time-limit 0.5)
;; (setq company-quickhelp-delay 0.2)
;; (company-quickhelp-mode)
(setq cquery-executable "/usr/bin/cquery")
(require 'cquery)
(require 'company-lsp)
(push 'company-lsp company-backends)
(setq company-lsp-async 't)
(require 'lsp-ui)
(add-hook 'lsp-mode-hook 'lsp-ui-mode)
(setq company-transformers nil company-lsp-async t company-lsp-cache-candidates nil)
(setq cquery-extra-init-params '(:index (:comments 2) :cacheFormat "msgpack" :completion (:detailedLabel t)))
(defun cquery//enable ()
(condition-case nil
(lsp-cquery-enable)
(user-error nil)))
(add-hook 'c-mode-hook #'cquery//enable)
(add-hook 'c++-mode-hook #'cquery//enable)
;; (setq company-backends '((company-capf company-files :with company-yasnippet) (company-lsp company-dabbrev-code company-dabbrev)))
;; '(company-irony company-bbdb company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-files (company-dabbrev-code company-gtags company-etags company-keywords) company-oddmuse company-dabbrev))
(custom-set-faces
;; '(company-preview
;; ((t (:foreground "darkgray" :underline t))))
;; '(coympany-preview-common
;; ((t (:inherit company-preview))))
;; '(company-tooltip
;; ((t (:background "lightgray" :foreground "black"))))
;; '(company-tooltip-selection
;; ((t (:background "steelblue" :foreground "white"))))
'(company-tooltip-common
((((type x)) (:inherit company-tooltip :weight bold))
(t (:inherit company-tooltip))))
'(company-tooltip-common-selection
((((type x)) (:inherit company-tooltip-selection :weight bold))
(t (:inherit company-tooltip-selection)))))
;; (setq company-backends '( (company-semantic) (company-gtags company-etags company-keywords company-yasnippet :with) company-cmake company-capf company-dabbrev-code company-files company-dabbrev ))
;; (company-gtags company-capf company-yasnippet company-clang company-semantic company-c-headers company-files )
(global-set-key (kbd "<f5>") (lambda ()
(interactive)
(setq-local compilation-read-command nil)
(call-interactively 'compile)))
(eval-after-load 'company
'(progn
(define-key company-active-map (kbd "C-TAB") 'company-complete-common-or-cycle)
(define-key company-active-map (kbd "<C-tab>") 'company-complete-common-or-cycle)))
;; (setq company-backends
;; '(company-irony company-bbdb company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-files (company-dabbrev-code company-gtags company-etags company-keywords) company-oddmuse company-dabbrev))
(global-flycheck-mode)
(require 'srefactor)
(require 'srefactor-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)
(add-hook 'c-initialization-hook (lambda ()
(define-key c-mode-base-map [(meta o)] 'ff-get-other-file))
)
;; (add-hook 'c++-mode-hook 'irony-mode)
;; (add-hook 'c-mode-hook 'irony-mode)
;; (add-hook 'objc-mode-hook 'irony-mode)
;; (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
;; ( add-hook 'irony-mode-hook 'irony-eldoc)
;; (add-to-list 'company-backends 'company-irony)
;; (eval-after-load 'company '( add-to-list 'company-c-headers-path-system "/usr/include/c++/8.1.1/"))
(eval-after-load 'flycheck '(add-hook 'flycheck-mode-hook 'flycheck-irony-setup))
(add-hook 'c-mode-hook 'c-turn-on-eldoc-mode)
(add-hook 'c++-mode-hook 'c-turn-on-eldoc-mode)
(require 'compile)
;;(define-globalized-minor-mode global-hs-minor-mode hs-minor-mode hs-minor-mode)
(setq hs-isearch-open 't)
(defun display-code-line-counts (ov)
(when (eq 'code (overlay-get ov 'hs))
(overlay-put ov 'help-echo
(buffer-substring (overlay-start ov)
(overlay-end ov)))))
(setq hs-set-up-overlay 'display-code-line-counts)
(defun toggle-selective-display (column)
(interactive "P")
(set-selective-display
(or column
(unless selective-display
(1+ (current-column))))))
(defun toggle-hiding (column)
(interactive "P")
(if hs-minor-mode
(if (condition-case nil
(hs-toggle-hiding)
(error t))
(hs-show-all))
(toggle-selective-display column)))
;; (require 'hideshow-org)
;; (add-hook 'c++-mode-hook 'hs-minor-mode)
(require 'hideshowvis)
(autoload 'hideshowvis-enable "hideshowvis" "Highlight foldable regions")
(autoload 'hideshowvis-minor-mode "hideshowvis"
"Will indicate regions foldable with hideshow in the fringe."
'interactive)
;; (hideshow-enable)
;; (dolist (hook (list 'emacs-lisp-mode-hook
;; 'c++-mode-hook))
;; (add-hook hook 'hideshowvis-enable))
(defvar ihs-special-modes-alist
(mapcar 'purecopy
'((c-mode "{" "}" "/[*/]" nil nil)
(c++-mode "{" "}" "/[*/]" nil nil)
(c++-mode "//{" "//}" "/[*/]" nil nil)
(bibtex-mode ("@\\S(*\\(\\s(\\)" 1))
(java-mode "{" "}" "/[*/]" nil nil)
(js-mode "{" "}" "/[*/]" nil))))
;; Hide the comments too when you do a 'hs-hide-all'
(setq hs-hide-comments nil)
;; Set whether isearch opens folded comments, code, or both
;; where x is code, comments, t (both), or nil (neither)
(setq hs-isearch-open 't)
(require 'dash)
(require 'outshine)
;; Required for outshine
(add-hook 'outline-minor-mode-hook 'outshine-hook-function)
;; Enables outline-minor-mode for *ALL* programming buffers
(add-hook 'prog-mode-hook 'outline-minor-mode)
;; (advice-add 'outshine-narrow-to-subtree :before
;; (lambda (&rest args) (unless (outline-on-heading-p t)
;; (outline-previous-visible-heading 1))))
(setq outshine-use-speed-commands t)
;; (load "folding" 'nomessage 'noerror)
;; (folding-mode-add-find-file-hook)
;; (setq folding-mode-prefix-key [kp-divide])
;; ;; (setq folding-load-hook 'my-folding-load-hook)
;; ;; And while I’m at it, any way of not narrowing every time I enter a fold?
;; (setq folding-narrow-by-default nil)
;; (add-hook 'c-mode-common-hook 'folding-mode)
;; (add-hook 'emacs-lisp-mode-hook 'folding-mode)
;; (add-hook 'lisp-mode-hook 'folding-mode)
;; (add-hook 'java-mode-hook 'folding-mode)
;; (add-hook 'perl-mode-hook 'folding-mode)
;; (add-hook 'sh-mode-hook 'folding-mode)
;; (folding-kbd (kbd "d") 'folding-shift-in )
;; (folding-kbd (kbd "a") 'folding-shift-out )
;; (folding-kbd (kbd "w") 'folding-previous-visible-heading)
;; (folding-kbd (kbd "s") 'folding-next-visible-heading)
;; (folding-kbd (kbd "<kp-subtract>") 'folding-show-current-subtree)
;; (folding-kbd (kbd "+") 'folding-hide-current-subtree)
;; (folding-add-to-marks-list 'lua-mode "-- {{{" "-- }}}" nil t)
;; (folding-add-to-marks-list 'c++-mode "// {{{" "// }}}" nil t) ;
;; (folding-add-to-marks-list 'ada-mode "-- {{{" "-- }}}" nil t)
;; (folding-add-to-marks-list 'asm-mode "; {{{" "; }}}" nil t)
;; (folding-add-to-marks-list 'awk-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'Bison-mode "/* {{{" "/* }}} */" " */" t)
;; (folding-add-to-marks-list 'LaTeX-mode "%{{{" "%}}}" nil t)
;; (folding-add-to-marks-list 'TeX-mode "%{{{" "%}}}" nil t)
;; (folding-add-to-marks-list 'bibtex-mode "%{{{" "%}}} */" nil t)
;; (folding-add-to-marks-list 'bison-mode "/* {{{" "/* }}} */" " */" t)
;; (folding-add-to-marks-list 'c-mode "/* {{{" "/* }}} */" " */" t)
;; (folding-add-to-marks-list 'dcl-mode "! {{{" "! }}}" nil t)
;; (folding-add-to-marks-list 'change-log-mode "{{{" "}}}" nil t)
;; (folding-add-to-marks-list 'cperl-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'emacs-lisp-mode ";;{{{" ";;}}}" nil t)
;; (folding-add-to-marks-list 'erlang-mode "%%{{{" "%%}}}" nil t)
;; (folding-add-to-marks-list 'finder-mode "{{{" "}}}" nil t)
;; (folding-add-to-marks-list 'fortran-mode "! {{{" "! }}}" nil t)
;; (folding-add-to-marks-list 'f90-mode "! {{{" "! }}}" nil t)
;; (folding-add-to-marks-list 'generic-mode ";# " ";\$" nil t)
;; (folding-add-to-marks-list 'gofer-mode "-- {{{" "-- }}}" nil t)
;; (folding-add-to-marks-list 'html-mode "<!-- {{{ " "<!-- }}} -->" " -->" t)
;; (folding-add-to-marks-list 'icon-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'indented-text-mode "{{{" "}}}" nil t)
;; (folding-add-to-marks-list 'java-mode "// {{{" "// }}}" nil t)
;; (folding-add-to-marks-list 'javascript-mode "// {{{" "// }}}" nil t)
;; (folding-add-to-marks-list 'jde-mode "// {{{" "// }}}" nil t)
;; (folding-add-to-marks-list 'ksh-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'latex-mode "%{{{" "%}}}" nil t)
;; (folding-add-to-marks-list 'lisp-interaction-mode ";;{{{" ";;}}}" nil t)
;; (folding-add-to-marks-list 'lisp-mode ";;{{{" ";;}}}" nil t)
;; (folding-add-to-marks-list 'm4-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'makefile-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'matlab-mode "%%%{{{" "%%%}}}" nil t)
;; (folding-add-to-marks-list 'meta-mode "% {{{" "% }}}" nil t)
;; (folding-add-to-marks-list 'ml-mode "(* {{{" "(* }}} *)" " *)" t)
;; (folding-add-to-marks-list 'modula-2-mode "(* {{{" "(* }}} *)" " *)" t)
;; (folding-add-to-marks-list 'nroff-mode "\\\\ {{{" "\\\\ }}}" nil t)
;; (folding-add-to-marks-list 'occam-mode "-- {{{" "-- }}}" nil t)
;; (folding-add-to-marks-list 'orwell-mode "{{{" "}}}" nil t)
;; (folding-add-to-marks-list 'pascal-mode "{ ((( " "{ ))) }" " }" t)
;; (folding-add-to-marks-list 'php-mode "// {{{" "// }}}" nil t)
;; (folding-add-to-marks-list 'perl-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'plain-TeX-mode "%{{{" "%}}}" nil t)
;; (folding-add-to-marks-list 'plain-tex-mode "%{{{" "%}}}" nil t)
;; (folding-add-to-marks-list 'prolog-mode "% {{{" "% }}}" nil t)
;; (folding-add-to-marks-list 'python-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'rexx-mode "/* {{{" "/* }}} */" " */" t)
;; (folding-add-to-marks-list 'sh-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'sh-script-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'shellscript-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'sgml-mode "<!-- [[[ " "<!-- ]]] -->" " -->" t)
;; (folding-add-to-marks-list 'simula-mode "! {{{" "! }}}" nil t)
;; (folding-add-to-marks-list 'sml-mode "(* {{{" "(* }}} *)" " *)" t)
;; (folding-add-to-marks-list 'sql-mode "-- {{{" "-- }}}" nil t)
;; (folding-add-to-marks-list 'tcl-mode "#{{{" "#}}}" nil t)
;; (folding-add-to-marks-list 'tex-mode "%{{{" "%}}}" nil t)
;; (folding-add-to-marks-list 'texinfo-mode "@c {{{" "@c {{{endfold}}}" " }}}" t)
;; (folding-add-to-marks-list 'text-mode "{{{" "}}}" nil t)
;; (folding-add-to-marks-list 'vhdl-mode "# {{{" "# }}}" nil t)
;; (folding-add-to-marks-list 'xerl-mode "%%{{{" "%%}}}" nil t)
;; (folding-add-to-marks-list 'xrdb-mode "! {{{" "! }}}" nil t)
;; (add-hook 'ag-mode-hook 'winnow-mode)
;; (add-hook 'compilation-mode-hook 'winnow-mode) ;; for winnow
glfw
BEGIN_SRC emacs-lisp (defun my-autocomplete-command () (interactive) (helm :sources ‘my-source :input (word-at-point) :buffer ”helm my autocomplete command”))
(helm-build-in-buffer-source “test1” :data ‘(a b c d e))
(helm :sources (helm-build-in-buffer-source “test1” :data ‘(a b c d e)) :buffer ”helm buffer source”)
:candidates ‘(a b c d e))
(helm :sources (helm-build-sync-source “test” :candidates ‘(a b c d e)) :buffer ”helm sync source”) (helm :sources (helm-build-in-file-source “test” “~/.emacs.d/init.el” :action (lambda (candidate) (let ((linum (with-helm-buffer (get-text-property 1 ‘helm-linum (helm-get-selection nil ‘withprop))))) (find-file (with-helm-buffer (helm-attr ‘candidates-file))) (goto-line linum)))) :buffer ”helm test”)
imenu-anywhere provides navigation for imenu tags across all buffers that satisfy a filtering criteria. Available criteria are - all buffers with the same major mode, same project buffers and user defined list of friendly mode buffers.
; (require 'goto-last-change)
(add-hook ‘comint-output-filter-functions ‘comint-strip-ctrl-m)
(defun sh-send-line-or-region (&optional step) (interactive ()) (let ((proc (get-process “shell”)) pbuf min max command) (unless proc (let ((currbuff (current-buffer))) (shell) (switch-to-buffer currbuff) (setq proc (get-process “shell”)) )) (setq pbuff (process-buffer proc)) (if (use-region-p) (setq min (region-beginning) max (region-end)) (setq min (point-at-bol) max (point-at-eol))) (setq command (concat (buffer-substring min max) “\n”)) (with-current-buffer pbuff (goto-char (process-mark proc)) (insert command) (move-marker (process-mark proc) (point)) ) ;;pop-to-buffer does not work with save-current-buffer – bug? (process-send-string proc command) (display-buffer (process-buffer proc) t) (when step (goto-char max) (next-line)) ))
(defun sh-send-line-or-region-and-step () (interactive) (sh-send-line-or-region t)) (defun sh-switch-to-process-buffer () (interactive) (pop-to-buffer (process-buffer (get-process “shell”)) t))
;; # (define-key sh-mode-map [(control ?j)] ‘sh-send-line-or-region-and-step) ;; # (define-key sh-mode-map [(control ?c) (control ?z)] ‘sh-switch-to-process-buffer)