aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2018-08-09 19:05:47 -0500
committerJesús <heckyel@hyperbola.info>2018-08-09 19:05:47 -0500
commit532be544895ab159084c695903755ccfe1737ff0 (patch)
tree5fe5ce9169e72d15c3c683eed36537db7ce0d671
parente81fd91879c4daa9834b5a3fa71b9ad0bf076e00 (diff)
downloademacs-base-532be544895ab159084c695903755ccfe1737ff0.tar.lz
emacs-base-532be544895ab159084c695903755ccfe1737ff0.tar.xz
emacs-base-532be544895ab159084c695903755ccfe1737ff0.zip
impor features from emacs-personal
→ https://gitlab.com/heckyel-ng/emacs-personal
-rw-r--r--custom.el3
-rw-r--r--init.el9
-rw-r--r--lisp/init-editing-utils.el7
-rw-r--r--lisp/init-flycheck.el10
-rw-r--r--lisp/init-gui.el3
-rw-r--r--lisp/init-less.el7
-rw-r--r--lisp/init-php.el64
-rw-r--r--lisp/init-pkgbuild.el6
-rw-r--r--lisp/init-python.el10
-rw-r--r--lisp/init-rainbow.el10
-rw-r--r--lisp/init-sass.el7
-rw-r--r--lisp/init-scss.el8
-rw-r--r--lisp/init-security.el12
13 files changed, 153 insertions, 3 deletions
diff --git a/custom.el b/custom.el
index 317da69..69fbb04 100644
--- a/custom.el
+++ b/custom.el
@@ -1,3 +1,4 @@
+
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@@ -10,7 +11,7 @@
'(anzu-search-threshold 1000)
'(package-selected-packages
(quote
- (markdown-mode sublime-themes sml-modeline smart-mode-line-powerline-theme nlinum flycheck anzu))))
+ (rainbow-mode scss-mode sass-mode less-css-mode ac-php smarty-mode php-mode pkgbuild-mode markdown-mode flycheck anzu sml-modeline smart-mode-line-powerline-theme smart-mode-line nlinum sublime-themes))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
diff --git a/init.el b/init.el
index 3b6d552..d7e6c91 100644
--- a/init.el
+++ b/init.el
@@ -23,6 +23,7 @@
;;;------------------------------
;;; Features
;;;------------------------------
+(require 'init-security)
(require 'init-elpa)
;; theme
(require 'init-theme)
@@ -37,6 +38,14 @@
(require 'init-flycheck)
;; Languages
(require 'init-markdown)
+(require 'init-python)
+(require 'init-pkgbuild)
+(require 'init-php)
+(require 'init-less)
+(require 'init-sass)
+(require 'init-scss)
+;; Plus
+(require 'init-rainbow)
;;; Loads custom file
(when (file-exists-p custom-file)
diff --git a/lisp/init-editing-utils.el b/lisp/init-editing-utils.el
index 0319519..5f65ef7 100644
--- a/lisp/init-editing-utils.el
+++ b/lisp/init-editing-utils.el
@@ -9,6 +9,12 @@
;;(when (eval-when-compile (version< "24.4" emacs-version))
;; (electric-indent-mode 1))
+;; Active auto-revert-mode that automatically reloads modified files out of Emacs.
+;; It is very useful to see logs (like auto-revert-tail-mode) among many other cases.
+(global-auto-revert-mode)
+(setq global-auto-revert-non-file-buffers t
+ auto-revert-verbose nil)
+
;;----------------------------------------------------------------------------
;; Show matching parens
;;----------------------------------------------------------------------------
@@ -19,7 +25,6 @@
;;----------------------------------------------------------------------------
(set-default 'truncate-lines t)
(setq show-trailing-whitespace nil)
-(setq site-lisp-path (file-name-as-directory (expand-file-name "site-lisp/" user-emacs-directory)))
;;----------------------------------------------------------------------------
;; Some basic preferences
diff --git a/lisp/init-flycheck.el b/lisp/init-flycheck.el
index a3f6c37..d7a7ac5 100644
--- a/lisp/init-flycheck.el
+++ b/lisp/init-flycheck.el
@@ -1,2 +1,12 @@
(require-package 'flycheck)
+
+;; Enable for only languages
+;;(add-hook 'emacs-lisp-mode-hook 'flycheck-mode)
+(add-hook 'c++-mode-hook 'flycheck-mode)
+(add-hook 'html-mode-hook 'flycheck-mode)
+(add-hook 'sh-mode-hook 'flycheck-mode)
+(add-hook 'js-mode-hook 'flycheck-mode)
+(add-hook 'php-mode-hook 'flycheck-mode)
+;; (add-hook 'after-init-hook 'global-flycheck-mode)
+
(provide 'init-flycheck)
diff --git a/lisp/init-gui.el b/lisp/init-gui.el
index ccc0786..3339e21 100644
--- a/lisp/init-gui.el
+++ b/lisp/init-gui.el
@@ -8,7 +8,8 @@
(tool-bar-mode 0)
(set-scroll-bar-mode nil)
(menu-bar-mode 0)
-(setq make-backup-files nil)
+(setq make-backup-files nil) ; stop creating backup~ files
+(setq auto-save-default nil) ; stop creating #autosave# files
;;----------------------------------------------------------------------------
;; Editor configuration
diff --git a/lisp/init-less.el b/lisp/init-less.el
new file mode 100644
index 0000000..5245e5f
--- /dev/null
+++ b/lisp/init-less.el
@@ -0,0 +1,7 @@
+;;----------------------------------------------------------------------------
+;; Less Mode
+;;----------------------------------------------------------------------------
+(require-package 'less-css-mode)
+(add-to-list 'auto-mode-alist '("\\.less$" . less-css-mode))
+
+(provide 'init-less)
diff --git a/lisp/init-php.el b/lisp/init-php.el
new file mode 100644
index 0000000..d4fa09b
--- /dev/null
+++ b/lisp/init-php.el
@@ -0,0 +1,64 @@
+(require-package 'php-mode)
+
+(require-package 'smarty-mode)
+
+;; From EmacsWiki: https://www.emacswiki.org/emacs/PhpMode
+(defun my/php-symbol-lookup ()
+ (interactive)
+ (let ((symbol (symbol-at-point)))
+ (if (not symbol)
+ (message "No symbol at point.")
+
+ (browse-url (concat "https://php.net/manual-lookup.php?pattern="
+ (symbol-name symbol))))))
+
+
+(defun my/php-function-lookup ()
+ (interactive)
+ (let* ((function (symbol-name (or (symbol-at-point)
+ (error "No function at point."))))
+ (buf (url-retrieve-synchronously (concat "https://php.net/manual-lookup.php?pattern=" function))))
+ (with-current-buffer buf
+ (goto-char (point-min))
+ (let (desc)
+ (when (re-search-forward "<div class=\"methodsynopsis dc-description\">\\(\\(.\\|\n\\)*?\\)</div>" nil t)
+ (setq desc
+ (replace-regexp-in-string
+ " +" " "
+ (replace-regexp-in-string
+ "\n" ""
+ (replace-regexp-in-string "<.*?>" "" (match-string-no-properties 1)))))
+
+ (when (re-search-forward "<p class=\"para rdfs-comment\">\\(\\(.\\|\n\\)*?\\)</p>" nil t)
+ (setq desc
+ (concat desc "\n\n"
+ (replace-regexp-in-string
+ " +" " "
+ (replace-regexp-in-string
+ "\n" ""
+ (replace-regexp-in-string "<.*?>" "" (match-string-no-properties 1))))))))
+
+ (if desc
+ (message desc)
+ (message "Could not extract function info. Press C-F1 to go the description."))))
+ (kill-buffer buf)))
+
+(require-package 'ac-php)
+
+(defun my/php-mode-stuff ()
+ (local-set-key (kbd "<f1>") 'my/php-function-lookup)
+ (local-set-key (kbd "C-<f1>") 'my/php-symbol-lookup)
+ ;; New versions of PHP have this :)
+ (php-enable-psr2-coding-style)
+ (auto-complete-mode t)
+ (require 'ac-php)
+ (setq ac-sources '(ac-source-dictionary ac-source-abbrev ac-source-php ) )
+ (ac-php-core-eldoc-setup ) ;enable eldoc
+ (define-key php-mode-map (kbd "C-]") 'ac-php-find-symbol-at-point) ;goto define
+ (define-key php-mode-map (kbd "C-t") 'ac-php-location-stack-back) ;go back
+ )
+
+(add-hook 'php-mode-hook 'my/php-mode-stuff)
+
+(myemacs/elapsed-time)
+(provide 'init-php)
diff --git a/lisp/init-pkgbuild.el b/lisp/init-pkgbuild.el
new file mode 100644
index 0000000..10ce393
--- /dev/null
+++ b/lisp/init-pkgbuild.el
@@ -0,0 +1,6 @@
+(require-package 'pkgbuild-mode)
+
+(autoload 'pkgbuild-mode "pkgbuild-mode.el" "PKGBUILD mode." t)
+(setq auto-mode-alist (append '(("/PKGBUILD$" . pkgbuild-mode)) auto-mode-alist))
+
+(provide 'init-pkgbuild)
diff --git a/lisp/init-python.el b/lisp/init-python.el
new file mode 100644
index 0000000..eee16f7
--- /dev/null
+++ b/lisp/init-python.el
@@ -0,0 +1,10 @@
+;;----------------------------------------------------------------------------
+;; Python Mode
+;;----------------------------------------------------------------------------
+(add-hook 'python-mode-hook
+ (lambda ()
+ (setq indent-tabs-mode nil)
+ (setq python-indent-guess-indent-offset nil)
+ (setq python-indent-offset 4)))
+
+(provide 'init-python)
diff --git a/lisp/init-rainbow.el b/lisp/init-rainbow.el
new file mode 100644
index 0000000..4461279
--- /dev/null
+++ b/lisp/init-rainbow.el
@@ -0,0 +1,10 @@
+;; rainbow-mode
+(require-package 'rainbow-mode)
+(add-hook 'css-mode-hook 'rainbow-mode)
+(add-hook 'sass-mode-hook 'rainbow-mode)
+(add-hook 'scss-mode-hook 'rainbow-mode)
+(add-hook 'less-mode-hook 'rainbow-mode)
+(add-hook 'web-mode-hook 'rainbow-mode)
+(add-hook 'html-mode-hook 'rainbow-mode)
+
+(provide 'init-rainbow)
diff --git a/lisp/init-sass.el b/lisp/init-sass.el
new file mode 100644
index 0000000..022668c
--- /dev/null
+++ b/lisp/init-sass.el
@@ -0,0 +1,7 @@
+;;----------------------------------------------------------------------------
+;; Sass Mode
+;;----------------------------------------------------------------------------
+(require-package 'sass-mode)
+(add-to-list 'auto-mode-alist '("\\.sass\\'" . sass-mode))
+
+(provide 'init-sass)
diff --git a/lisp/init-scss.el b/lisp/init-scss.el
new file mode 100644
index 0000000..2ec96d5
--- /dev/null
+++ b/lisp/init-scss.el
@@ -0,0 +1,8 @@
+;;----------------------------------------------------------------------------
+;; Scss Mode
+;;----------------------------------------------------------------------------
+(require-package 'scss-mode)
+
+(add-to-list 'auto-mode-alist '("\\.scss\\'" . scss-mode))
+
+(provide 'init-scss)
diff --git a/lisp/init-security.el b/lisp/init-security.el
new file mode 100644
index 0000000..87d4a0c
--- /dev/null
+++ b/lisp/init-security.el
@@ -0,0 +1,12 @@
+;;----------------------------------------------------------------------------
+;; Security. Check https://ogbe.net/emacsconfig.html
+;;----------------------------------------------------------------------------
+(setq tls-checktrust t)
+(setq gnutls-verify-error t)
+(let ((trustfile "/etc/ssl/cert.pem"))
+ (setq tls-program
+ `(,(format "gnutls-cli --x509cafile %s -p %%p %%h" trustfile)
+ ,(format "openssl s_client -connect %%h:%%p -CAfile %s -no_ssl2 -ign_eof" trustfile)))
+ (setq gnutls-trustfiles (list trustfile)))
+
+(provide 'init-security)