more stuff

This commit is contained in:
Abraham Raji 2018-09-21 15:38:43 +05:30
parent 152f161f33
commit 217a6c969d
3231 changed files with 33153 additions and 57 deletions

View File

@ -1,2 +0,0 @@
/home/guyfawkes/Documents/code/#test.org#
/home/guyfawkes/Documents/code/##test.org##

View File

@ -0,0 +1,4 @@
/home/guyfawkes/.emacs.d/config.org
/home/guyfawkes/.emacs.d/#config.org#
/home/guyfawkes/Documents/hrsconfig.org
/home/guyfawkes/Documents/#hrsconfig.org#

View File

@ -1,5 +1,8 @@
(setq user-full-name "Abraham Raji")
(setq user-mail-address "abrahamraji99@gmail.com")
(setq user-full-name "Abraham Raji"
user-mail-address "abrahamraji99@gmail.com")
; calendar-latitude 9.738909
; calendar-longitude 76.719904
; calendar-location-name "Pravithanam, Pala KTM "
;; Sets the frame title as by http://www.emacswiki.org/emacs/FrameTitle
(setq frame-title-format (list "%b %[- GNU %F " emacs-version)
icon-title-format (list "%b- GNU %F " emacs-version))
@ -36,17 +39,52 @@ icon-title-format (list "%b- GNU %F " emacs-version))
(add-to-list 'default-frame-alist
'(font . "DejaVu Sans Mono-10"))
(use-package flycheck
(defun 4br/visit-emacs-config ()
(interactive)
(find-file "~/.emacs.d/config.org"))
(global-set-key (kbd "C-c e") '4br/visit-emacs-config)
(use-package elpy
:ensure t
:init
(global-flycheck-mode t))
:config
(elpy-enable))
(use-package flycheck
:ensure t
:init
(global-flycheck-mode t))
(add-hook 'elpy-mode-hook 'flycheck-mode)
;This creates a flycheck checker that runs proselint in texty buffers and displays my errors.
(flycheck-define-checker proselint
"A linter for prose."
:command ("proselint" source-inplace)
:error-patterns
((warning line-start (file-name) ":" line ":" column ": "
(id (one-or-more (not (any " "))))
(message (one-or-more not-newline)
(zero-or-more "\n" (any " ") (one-or-more not-newline)))
line-end))
:modes (text-mode markdown-mode gfm-mode org-mode))
; flycheck in the appropriate buffers
(add-to-list 'flycheck-checkers 'proselint)
(add-hook 'markdown-mode-hook #'flycheck-mode)
(add-hook 'gfm-mode-hook #'flycheck-mode)
(add-hook 'text-mode-hook #'flycheck-mode)
(add-hook 'org-mode-hook #'flycheck-mode)
(use-package htmlize
:ensure t)
(setq org-html-postamble nil)
(use-package liso-theme
:ensure t
:config (load-theme 'liso t))
(defun transparency (value)
"Sets the transparency of the frame window. 0=transparent/100=opaque."
(interactive "nTransparency Value 0 - 100 opaque:")
(set-frame-parameter (selected-frame) 'alpha value)
(transparency 90))
(add-to-list 'load-path "/home/guyfawkes/.emacs.d/matlab-emacs-master")
(load-library "matlab-load")
@ -73,9 +111,6 @@ icon-title-format (list "%b- GNU %F " emacs-version))
:config
(which-key-mode))
(use-package elpy
:ensure t
:config
(elpy-enable))
(require 'ox-md)
(setq-default dired-listing-switches "-lhvA")

View File

@ -1,12 +1,26 @@
#+TITLE: Emacs Configuration
#+AUTHOR: Abraham Raji
#+EMAIL: abrahamraji99@gmail.com
* Personal Settings
** My Info
#+BEGIN_SRC emacs-lisp
(setq user-full-name "Abraham Raji")
(setq user-mail-address "abrahamraji99@gmail.com")
(setq user-full-name "Abraham Raji"
user-mail-address "abrahamraji99@gmail.com")
; calendar-latitude 9.738909
; calendar-longitude 76.719904
; calendar-location-name "Pravithanam, Pala KTM "
;; Sets the frame title as by http://www.emacswiki.org/emacs/FrameTitle
(setq frame-title-format (list "%b %[- GNU %F " emacs-version)
icon-title-format (list "%b- GNU %F " emacs-version))
#+END_SRC
** org Stuff
#+BEGIN_SRC elisp
(setq org-ellipsis "⤵")
(setq org-src-fontify-natively t);;syntax highlighting in source blocks while editing
(add-hook 'org-mode-hook 'flyspell-mode);;spellcheck
#+END_SRC
** One-line Settings
#+BEGIN_SRC emacs-lisp
(setq inhibit-startup-message t)
@ -43,11 +57,65 @@
(add-hook 'pre-command-hook 'my-menu-bar-open-after))))
(global-set-key [f10] 'my-menu-bar-open)
#+END_SRC
** Font
#+BEGIN_SRC emacs-lisp
(add-to-list 'default-frame-alist
'(font . "DejaVu Sans Mono-10"))
** Scrolling
-System Scroll bars.
#+BEGIN_SRC elisp
(scroll-bar-mode -1)
#+END_SRC
-Minibuffer Scroll bars.
#+BEGIN_SRC elisp
(set-window-scroll-bars (minibuffer-window) nil nil)
#+END_SRC
- Scroll Conservatively
#+BEGIN_SRC elisp
(setq scroll-conservatively 100)
#+END_SRC
** Text
- Nice Fonts
#+BEGIN_SRC emacs-lisp
(add-to-list 'default-frame-alist
'(font . "DejaVu Sans Mono-10"))
#+END_SRC
- Fancy Lambdas
#+BEGIN_SRC elsip
(global-prettify-symbols-mode t)
#+END_SRC
- Highlight current line
#+BEGIN_SRC elisp
(global-hl-line-mode)
#+END_SRC
** Modeline
#+BEGIN_SRC elisp
(defmacro diminish-minor-mode (filename mode &optional abbrev)
`(eval-after-load (symbol-name ,filename)
'(diminish ,mode ,abbrev)))
(defmacro diminish-major-mode (mode-hook abbrev)
`(add-hook ,mode-hook
(lambda () (setq mode-name ,abbrev))))
(diminish-minor-mode 'abbrev 'abbrev-mode)
(diminish-minor-mode 'simple 'auto-fill-function)
(diminish-minor-mode 'company 'company-mode)
(diminish-minor-mode 'eldoc 'eldoc-mode)
(diminish-minor-mode 'flycheck 'flycheck-mode)
(diminish-minor-mode 'flyspell 'flyspell-mode)
(diminish-minor-mode 'global-whitespace 'global-whitespace-mode)
(diminish-minor-mode 'projectile 'projectile-mode)
(diminish-minor-mode 'ruby-end 'ruby-end-mode)
(diminish-minor-mode 'subword 'subword-mode)
(diminish-minor-mode 'undo-tree 'undo-tree-mode)
(diminish-minor-mode 'yard-mode 'yard-mode)
(diminish-minor-mode 'yasnippet 'yas-minor-mode)
(diminish-minor-mode 'wrap-region 'wrap-region-mode)
(diminish-minor-mode 'paredit 'paredit-mode " π")
(diminish-major-mode 'emacs-lisp-mode-hook "el")
(diminish-major-mode 'haskell-mode-hook "λ=")
(diminish-major-mode 'lisp-interaction-mode-hook "λ")
(diminish-major-mode 'python-mode-hook "Py")
#+END_SRC
** Babel in org-mode
#+BEGIN_SRC
; And add babel inline code execution
@ -61,30 +129,86 @@
(js . t)
(python . t)
#+END_SRC
** TEX
#+BEGIN_SRC elisp
(setq TeX-parse-self t)
(setq TeX-PDF-mode t)
(add-hook 'LaTeX-mode-hook
(lambda ()
(LaTeX-math-mode)
(setq TeX-master t)))
#+END_SRC
** Quickly visit Emacs configuration
I futz around with my dotfiles a lot. This binds =C-c e= to quickly open my
Emacs configuration file.
#+BEGIN_SRC emacs-lisp
(defun 4br/visit-emacs-config ()
(interactive)
(find-file "~/.emacs.d/config.org"))
(global-set-key (kbd "C-c e") '4br/visit-emacs-config)
#+END_SRC
* Packages
** auto-complete
;; #+BEGIN_SRC emacs-lisp
;; (ac-config-default)
;; (global-auto-complete-mode t)
;; (add-to-list 'ac-modes 'org-mode)
;; #+END_SRC
; #+BEGIN_SRC emacs-lisp
; (ac-config-default)
; (global-auto-complete-mode t)
; (add-to-list 'ac-modes 'org-mode)
; #+END_SRC
** css-mode
#+BEGIN_SRC elisp
(use-package css-mode)
#+END_SRC
** elpy
#+BEGIN_SRC emacs-lisp
(use-package elpy
:ensure t
:config
(elpy-enable))
#+END_SRC
** flycheck
#+BEGIN_SRC emacs-lisp
(use-package flycheck
:ensure t
:init
(global-flycheck-mode t))
(add-hook 'elpy-mode-hook 'flycheck-mode)
;This creates a flycheck checker that runs proselint in texty buffers and displays my errors.
(flycheck-define-checker proselint
"A linter for prose."
:command ("proselint" source-inplace)
:error-patterns
((warning line-start (file-name) ":" line ":" column ": "
(id (one-or-more (not (any " "))))
(message (one-or-more not-newline)
(zero-or-more "\n" (any " ") (one-or-more not-newline)))
line-end))
:modes (text-mode markdown-mode gfm-mode org-mode))
; flycheck in the appropriate buffers
(add-to-list 'flycheck-checkers 'proselint)
(add-hook 'markdown-mode-hook #'flycheck-mode)
(add-hook 'gfm-mode-hook #'flycheck-mode)
(add-hook 'text-mode-hook #'flycheck-mode)
(add-hook 'org-mode-hook #'flycheck-mode)
#+END_SRC
** htmlize
#+BEGIN_SRC emacs-lisp
(use-package htmlize
(use-package htmlize
:ensure t)
(setq org-html-postamble nil)
#+END_SRC
** liso-theme
#+BEGIN_SRC emacs-lisp
(use-package liso-theme
:ensure t
:config (load-theme 'liso t))
(defun transparency (value)
"Sets the transparency of the frame window. 0=transparent/100=opaque."
(interactive "nTransparency Value 0 - 100 opaque:")
(set-frame-parameter (selected-frame) 'alpha value)
(transparency 90))
#+END_SRC
** matlab
@ -127,14 +251,50 @@
:config
(which-key-mode))
#+END_SRC
** elpy
#+BEGIN_SRC emacs-lisp
(use-package elpy
:ensure t
:config
(elpy-enable))
#+END_SRC
** ox-md
#+BEGIN_SRC emacs-lisp
(require 'ox-md)
#+END_SRC
** ox-beamer
#+BEGIN_SRC elisp
(require 'ox-beamer)
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(ruby . t)
(python . t)
(c . t)))
#+END_SRC
** Minted
#+BEGIN_SRC elisp
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted)
(setq org-latex-pdf-process
'("xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
#+END_SRC
** Dired
#+BEGIN_SRC elisp
(use-package dired-details)
(use-package dired+)
(use-package dired-open
:config
(setq dired-open-extensions
'(("pdf" . "evince")
("mkv" . "vlc")
("mp4" . "vlc")
("avi" . "vlc"))))
#+END_SRC
These are the switches that get passed to =ls= when =dired= gets a list of
files. We're using:
- =l=: Use the long listing format.
- =h=: Use human-readable sizes.
- =v=: Sort numbers naturally.
- =A=: Almost all. Doesn't include "=.=" or "=..=".
#+BEGIN_SRC emacs-lisp
(setq-default dired-listing-switches "-lhvA")
#+END_SRC

View File

@ -0,0 +1,22 @@
;;; ac-c-headers-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "ac-c-headers" "ac-c-headers.el" (0 0 0 0))
;;; Generated autoloads from ac-c-headers.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ac-c-headers" '("ac-")))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; ac-c-headers-autoloads.el ends here

View File

@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "ac-c-headers" "20151021.834" "auto-complete source for C headers" '((auto-complete "1.3.1")) :commit "de13a1d35b311e6601556d8ef163de102057deea" :authors '(("zk_phi")) :maintainer '("zk_phi") :url "http://hins11.yu-yake.com/")

View File

@ -0,0 +1,174 @@
;;; ac-c-headers.el --- auto-complete source for C headers
;; Copyright (C) 2013-2015 zk_phi
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
;; Author: zk_phi
;; URL: http://hins11.yu-yake.com/
;; Package-Version: 20151021.834
;; Version: 1.0.0
;; Package-Requires: ((auto-complete "1.3.1"))
;;; Commentary:
;; Require this script (and auto-complete) then add to ac-sources.
;;
;; (add-hook 'c-mode-hook
;; (lambda ()
;; (add-to-list 'ac-sources 'ac-source-c-headers)
;; (add-to-list 'ac-sources 'ac-source-c-header-symbols t)))
;;
;; then header filenames and symbols in imported headers are completed.
;;
;; #include <s[tdio.h>] <- ac-source-c-headers
;; pr[intf] <- ac-source-c-header-symbols
;;; Change Log:
;; 1.0.0 first released
;;; Code:
(require 'find-file)
;; + constants
(defconst ac-c-headers-version "1.0.0")
;; + filenames
(defvar ac-c-headers--files-cache nil
"list of (PREFIX . FILE-OR-DIRECTORY ...)")
(defun ac-c-headers--files-update (&optional prefix)
(setq prefix (or prefix ""))
(unless (assoc prefix ac-c-headers--files-cache)
(setq ac-c-headers--files-cache
(cons (cons prefix
(apply 'append
(mapcar
(lambda (dir)
(let ((path (concat (file-name-as-directory dir) prefix)))
(when (file-accessible-directory-p path)
(delq nil
(mapcar
(lambda (file)
(cond ((file-directory-p (concat path file))
(concat file "/"))
((string-match "\\h$" file)
file)
(t
nil)))
(directory-files path nil))))))
cc-search-directories)))
ac-c-headers--files-cache))))
(defun ac-c-headers--files-list (&optional point)
"returns possible completions at the point"
(save-excursion
(when point (goto-char point))
(when (looking-back "[<\"]\\([^<>\"]*?\\)\\([^<>\"/]*\\)")
(let ((prefix (match-string 1)))
(unless (assoc prefix ac-c-headers--files-cache)
(ac-c-headers--files-update prefix))
(cdr (assoc prefix ac-c-headers--files-cache))))))
;; + symbols in headers
(defvar ac-c-headers--symbols-cache nil
"list of (HEADER . SYMBOL ...)")
(defun ac-c-headers--search-header-file (header)
(catch 'found
(dolist (prefix cc-search-directories)
(let ((file (concat prefix
(unless (string-match "/$" prefix) "/")
header)))
(when (file-exists-p file)
(throw 'found file))))))
(defun ac-c-headers--symbols-update (header)
(unless (assoc header ac-c-headers--symbols-cache)
(let ((file (ac-c-headers--search-header-file header)))
(when (and file (file-exists-p file))
(with-temp-buffer
(insert-file-contents file)
;; delete /* comments */
(goto-char (point-min))
(while (search-forward-regexp
"/\\*\\([^*]\\|\\*[^/]\\)*\\*/" nil t)
(replace-match ""))
;; delete // comments
(goto-char (point-min))
(while (search-forward-regexp "//.*$" nil t)
(replace-match ""))
;; search symbols
(setq ac-c-headers--symbols-cache
(cons (cons header
(delete-dups
(let ((res nil))
(goto-char (point-min))
(while (search-forward-regexp
"\\_<[a-zA-Z_]*\\_>" nil t)
(setq res (cons (match-string 0) res)))
res)))
ac-c-headers--symbols-cache)))))))
(defun ac-c-headers--symbols-list (&optional buffer)
"returns possible completions for the buffer"
(setq buffer (or buffer (current-buffer)))
(with-current-buffer buffer
(let ((res nil) header)
(save-excursion
(goto-char (point-min))
(while (search-forward-regexp
"^#include *[<\"]\\([^>\"]*\\)[>\"]" nil t)
(setq header (match-string 1))
(unless (assoc header ac-c-headers--symbols-cache)
(ac-c-headers--symbols-update header))
(setq res (append (cdr (assoc header ac-c-headers--symbols-cache))
res))))
res)))
;; + ac-sources
(defvar ac-source-c-headers
'((prefix . "#include *[<\"][^<>\"]*?\\([^<>\"/]*\\)")
(candidates . ac-c-headers--files-list)
(action . (lambda ()
(when (string-match "\\.h$" candidate)
(ac-c-headers--symbols-update candidate)
(cond ((looking-at "[>\"]")
(forward-char 1)
(newline-and-indent))
((looking-back "#include *<\\([^<]*\\)")
(insert ">\n"))
(t
(insert "\"\n"))))))
(symbol . "h")
(requires . 0)
(cache)))
(defvar ac-source-c-header-symbols
'((candidates . ac-c-headers--symbols-list)
(symbol . "h")
(cache)))
;; + provide
(provide 'ac-c-headers)
;;; ac-c-headers.el ends here

Binary file not shown.

View File

@ -0,0 +1,11 @@
Require this script (and auto-complete) then add to ac-sources.
(add-hook 'c-mode-hook
(lambda ()
(add-to-list 'ac-sources 'ac-source-c-headers)
(add-to-list 'ac-sources 'ac-source-c-header-symbols t)))
then header filenames and symbols in imported headers are completed.
#include <s[tdio.h>] <- ac-source-c-headers
pr[intf] <- ac-source-c-header-symbols

View File

@ -0,0 +1,103 @@
;;; ac-haml.el --- auto complete source for html tag and attributes
;; Copyright (C) 2014 - 2015 Zhang Kai Yu
;; Author: Zhang Kai Yu <yeannylam@gmail.com>
;; Keywords: html, auto-complete, rails, ruby
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Configuration:
;;
;;; Code:
(require 'ac-html-core)
(require 'ac-slim) ;; haml and slim share some common things
(defun ac-haml-attr-prefix ()
(if (or (ac-slim-inside-ruby-code)
(ac-slim-inside-non-slim-block))
nil
(save-restriction
(save-excursion
(narrow-to-region
(line-beginning-position) (line-end-position))
(let ((origin (point)) (right nil) (left nil) (thing nil))
;; Go to next whitespace or line end
(re-search-forward "\\( \\|$\\)" nil t)
(if (equal (char-before) ? )
(backward-char))
(setq right (point))
(goto-char origin)
;; Go to previous whitespace or line beginning
(re-search-backward "\\( \\|^\\)" nil t)
(if (equal (char-after) ? )
(forward-char))
(setq left (point))
;; Figure out what at point
(setq thing (buffer-substring-no-properties left right))
(if (string= (substring thing 0 1) ":")
(1+ left)
nil))))))
(defun ac-haml-attrv-prefix ()
(if (re-search-backward "\\w+ *=[>]? *[\"]\\([^\"]+[ ]\\|\\)\\(.*\\)" nil t)
(match-beginning 2)))
(defun ac-haml-class-prefix ()
(ac-slim-class-prefix))
(defun ac-haml-id-prefix ()
(ac-slim-id-prefix))
(defun ac-haml-current-tag ()
"Return current haml tag user is typing on."
(save-excursion
(save-match-data
(re-search-backward "^[\t ]*%\\(\\w+\\)" nil t)
(match-string 1))))
(defun ac-haml-current-tag ()
"Return current haml tag user is typing on."
(let* ((line (buffer-substring-no-properties (line-beginning-position)
(line-end-position)))
(match-result (s-match "^[\t ]*%\\(\\w+\\)" line)))
(if match-result
(nth 1 match-result)
"div")))
(defun ac-haml-current-attr ()
"Return current html tag's attribute user is typing on."
(save-excursion (re-search-backward "[^a-z-]\\([a-z-]+\\) *=" nil t))
(match-string 1))
(defun ac-haml-attrv-prefix ()
(if (re-search-backward "\\w+ *=[>]? *[\"]\\([^\"]+[ ]\\|\\)\\(.*\\)" nil t)
(match-beginning 2)))
(ac-html-define-ac-source "haml"
:tag-prefix "^[ \t]*%\\(.*\\)"
:attr-prefix ac-haml-attr-prefix
:attrv-prefix ac-haml-attrv-prefix
:class-prefix ac-haml-class-prefix
:id-prefix ac-haml-id-prefix
:current-tag-func ac-haml-current-tag
:current-attr-func ac-haml-current-attr)
(provide 'ac-haml)
;;; ac-haml.el ends here

Binary file not shown.

View File

@ -0,0 +1,90 @@
;;; ac-html-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "ac-haml" "ac-haml.el" (0 0 0 0))
;;; Generated autoloads from ac-haml.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ac-haml" '("ac-haml-")))
;;;***
;;;### (autoloads nil "ac-html" "ac-html.el" (0 0 0 0))
;;; Generated autoloads from ac-html.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ac-html" '("ac-html-")))
;;;***
;;;### (autoloads nil "ac-html-core" "ac-html-core.el" (0 0 0 0))
;;; Generated autoloads from ac-html-core.el
(autoload 'ac-html-define-data-provider "ac-html-core" "\
Define ac-html data provider with this macro.
This macro is buggy and cannot be used now.
\(fn PROVIDER &rest PAIRS)" nil t)
(function-put 'ac-html-define-data-provider 'lisp-indent-function '1)
(autoload 'ac-html-enable-data-provider "ac-html-core" "\
Enable data provider PROVIDER.
\(fn PROVIDER)" nil nil)
(autoload 'ac-html-define-ac-source "ac-html-core" "\
Define ac-html lang with this macro.
\(fn LANG &rest PAIRS)" nil t)
(function-put 'ac-html-define-ac-source 'lisp-indent-function '1)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ac-html-core" '("ac-html-")))
;;;***
;;;### (autoloads nil "ac-html-default-data-provider" "ac-html-default-data-provider.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from ac-html-default-data-provider.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ac-html-default-data-provider" '("ac-html-" "web-completion-data-")))
;;;***
;;;### (autoloads nil "ac-html-testing-data-provider" "ac-html-testing-data-provider.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from ac-html-testing-data-provider.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ac-html-testing-data-provider" '("ac-html-testing-")))
;;;***
;;;### (autoloads nil "ac-jade" "ac-jade.el" (0 0 0 0))
;;; Generated autoloads from ac-jade.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ac-jade" '("ac-jade-")))
;;;***
;;;### (autoloads nil "ac-slim" "ac-slim.el" (0 0 0 0))
;;; Generated autoloads from ac-slim.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ac-slim" '("ac-slim-")))
;;;***
;;;### (autoloads nil nil ("ac-html-pkg.el") (0 0 0 0))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; ac-html-autoloads.el ends here

View File

@ -0,0 +1,263 @@
;;; ac-html-core.el --- auto complete html core -*- lexical-binding: t; -*-
;; Copyright (C) 2015 Zhang Kai Yu
;; Author: Zhang Kai Yu <yeannylam@gmail.com>
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'auto-complete)
(require 'cl-lib)
(require 'dash)
;;; Customization
(defgroup auto-complete-html nil
"HTML Auto Complete."
:group 'auto-complete
:prefix "ac-html-")
;;; Variables
(defvar ac-html-data-providers nil "Completion data providers.")
(defvar-local ac-html-enabled-data-providers nil
"The enabled data providers of current buffer.")
(defvar-local ac-html-current-tag-function nil
"The function to find current tag.")
(defvar-local ac-html-current-attr-function nil
"The function to find current attr.")
;;; Provider
;;;###autoload
(defmacro ac-html-define-data-provider (provider &rest pairs)
"Define ac-html data provider with this macro.
This macro is buggy and cannot be used now."
(declare (indent 1) (debug t))
(let (tag-func attr-func attrv-func id-func class-func tag-doc-func
attr-doc-func attrv-doc-func id-doc-func class-doc-func)
(let (label value)
(while (not (= 0 (length pairs)))
(setq label (pop pairs))
(setq value (pop pairs))
(and (equal :tag-func label) (setq tag-func value))
(and (equal :attr-func label) (setq attr-func value))
(and (equal :attrv-func label) (setq attrv-func value))
(and (equal :id-func label) (setq id-func value))
(and (equal :class-func label) (setq class-func value))
(and (equal :tag-doc-func label) (setq tag-doc-func value))
(and (equal :attr-doc-func label) (setq attr-doc-func value))
(and (equal :attrv-doc-func label) (setq attrv-doc-func value))
(and (equal :id-doc-func label) (setq id-doc-func value))
(and (equal :class-doc-func label) (setq class-doc-func value))))
`(progn
(add-to-list 'ac-html-data-providers ,provider)
(put ,provider :tag-func ,tag-func)
(put ,provider :attr-func ,attr-func)
(put ,provider :attrv-func ,attrv-func)
(put ,provider :id-func ,id-func)
(put ,provider :class-func ,class-func)
(put ,provider :tag-doc-func ,tag-doc-func)
(put ,provider :attr-doc-func ,attr-doc-func)
(put ,provider :attrv-doc-func ,attrv-doc-func)
(put ,provider :id-doc-func ,id-doc-func)
(put ,provider :class-doc-func ,class-doc-func))))
;;;###autoload
(defun ac-html-enable-data-provider (provider)
"Enable data provider PROVIDER."
(add-to-list 'ac-html-enabled-data-providers provider))
(defun ac-html-query-data-provider (provider key)
(get provider key))
;;; Language (Adaptor)
;;;###autoload
(defmacro ac-html-define-ac-source (lang &rest pairs)
"Define ac-html lang with this macro."
(declare (indent 1) (debug t))
(let (tag-prefix attr-prefix attrv-prefix id-prefix class-prefix
current-tag-func current-attr-func)
(let (label value)
(while (not (= 0 (length pairs)))
(setq label (pop pairs))
(setq value (pop pairs))
(and (equal :tag-prefix label) (setq tag-prefix value))
(and (equal :attr-prefix label) (setq attr-prefix value))
(and (equal :attrv-prefix label) (setq attrv-prefix value))
(and (equal :id-prefix label) (setq id-prefix value))
(and (equal :class-prefix label) (setq class-prefix value))
(and (equal :current-tag-func label) (setq current-tag-func value))
(and (equal :current-attr-func label) (setq current-attr-func value))))
`(progn
(defun ,(intern (format "ac-%s-setup" lang)) ()
,(format "Setup for ac-html to provide completion for %s language." lang)
(setq ac-html-current-tag-function (quote ,current-tag-func))
(setq ac-html-current-attr-function (quote ,current-attr-func)))
,(if tag-prefix
`(ac-define-source ,(format "%s-%s" lang "tag")
'((candidates . ac-html-all-tag-candidates)
(prefix . ,tag-prefix)
(document . ac-html-tag-documentation)
(symbol . "t"))))
,(if attr-prefix
`(ac-define-source ,(format "%s-%s" lang "attr")
'((candidates . ac-html-all-attr-candidates)
(prefix . ,attr-prefix)
(document . ac-html-attr-documentation)
(symbol . "a"))))
,(if attrv-prefix
`(ac-define-source ,(format "%s-%s" lang "attrv")
'((candidates . ac-html-all-attrv-candidates)
(prefix . ,attrv-prefix)
(document . ac-html-attrv-documentation)
(symbol . "v"))))
,(if id-prefix
`(ac-define-source ,(format "%s-%s" lang "id")
'((candidates . ac-html-all-id-candidates)
(prefix . ,id-prefix)
(document . ac-html-id-documentation)
(symbol . "i"))))
,(if class-prefix
`(ac-define-source ,(format "%s-%s" lang "class")
'((candidates . ac-html-all-class-candidates)
(prefix . ,class-prefix)
(document . ac-html-class-documentation)
(symbol . "c"))))
)))
;;; Data
(defun ac-html-all-tag-candidates ()
"All tag candidates get from data providers."
(let (list func)
(dolist (provider ac-html-enabled-data-providers)
(setq func (ac-html-query-data-provider provider :tag-func))
(if func (setq list (-concat list (funcall func)))))
list))
(defun ac-html-all-attr-candidates ()
"All attr candidates get from data providers."
(let (list func tag)
(dolist (provider ac-html-enabled-data-providers)
(setq func (ac-html-query-data-provider provider :attr-func))
(setq tag (funcall ac-html-current-tag-function))
(if func (setq list (-concat list (funcall func tag)))))
list))
(defun ac-html-all-attrv-candidates ()
"All attrv candidates get from data providers."
(let (list func tag attr)
(dolist (provider ac-html-enabled-data-providers)
(setq func (ac-html-query-data-provider provider :attrv-func))
(setq tag (funcall ac-html-current-tag-function))
(setq attr (funcall ac-html-current-attr-function))
(if func (setq list (-concat list (funcall func tag attr)))))
(if (string= attr "class")
(setq list (-concat list (ac-html-all-class-candidates))))
(if (string= attr "id")
(setq list (-concat list (ac-html-all-id-candidates))))
list))
(defun ac-html-all-id-candidates ()
""
(let (list func)
(dolist (provider ac-html-enabled-data-providers)
(setq func (ac-html-query-data-provider provider :id-func))
(if func (setq list (-concat list (funcall func)))))
list))
(defun ac-html-all-class-candidates ()
""
(let (list func)
(dolist (provider ac-html-enabled-data-providers)
(setq func (ac-html-query-data-provider provider :class-func))
(if func (setq list (-concat list (funcall func)))))
list))
(defun ac-html-tag-documentation (tag)
"Not documented yet."
(catch 'return-val
(let (doc func)
(dolist (provider ac-html-enabled-data-providers)
(setq func (ac-html-query-data-provider provider :tag-doc-func))
(if func
(progn
(setq doc (funcall func tag))
(if doc (throw 'return-val doc))))))))
(defun ac-html-attr-documentation (attr)
"Not documented yet."
(catch 'return-val
(let (doc func tag)
(dolist (provider ac-html-enabled-data-providers)
(setq func (ac-html-query-data-provider provider :attr-doc-func))
(if func
(progn
(setq tag (funcall ac-html-current-tag-function))
(setq doc (funcall func tag attr))
(if doc (throw 'return-val doc))))))))
(defun ac-html-attrv-documentation (attrv)
"Not documented yet."
(catch 'return-val
(let (doc func tag attr)
(dolist (provider ac-html-enabled-data-providers)
(setq func (ac-html-query-data-provider provider :attrv-doc-func))
(if func
(progn
(setq tag (funcall ac-html-current-tag-function))
(setq attr (funcall ac-html-current-attr-function))
(setq doc (funcall func tag attr attrv))
(if doc (throw 'return-val doc)))))
(if (string= attr "class")
(throw 'return-val (ac-html-class-documentation attrv)))
(if (string= attr "id")
(throw 'return-val (ac-html-id-documentation attrv))))))
(defun ac-html-id-documentation (id)
""
(catch 'return-val
(let (doc func)
(dolist (provider ac-html-enabled-data-providers)
(setq func (ac-html-query-data-provider provider :id-doc-func))
(if func
(progn
(setq doc (funcall func id))
(if doc (throw 'return-val doc))))))))
(defun ac-html-class-documentation (class)
""
(catch 'return-val
(let (doc func)
(dolist (provider ac-html-enabled-data-providers)
(setq func (ac-html-query-data-provider provider :class-doc-func))
(if func
(progn
(setq doc (funcall func class))
(if doc (throw 'return-val doc))))))))
(provide 'ac-html-core)
;;; ac-html-core.el ends here

Binary file not shown.

View File

@ -0,0 +1,139 @@
(require 'ac-html-core)
(require 'f)
;;; web-completion-data helpers
(defconst web-completion-data-package-dir
(file-name-directory (or load-file-name (buffer-file-name)))
"The directory where `web-completion-data' package exists.")
(defconst web-completion-data-html-source-dir
(expand-file-name "completion-data" web-completion-data-package-dir)
"The directory where basic completion source of `web-completion-data'
exists.")
(defconst web-completion-data-tag-list-file
(f-expand "html-tag-list" web-completion-data-html-source-dir))
(defconst web-completion-data-tag-doc-dir
(f-expand "html-tag-short-docs" web-completion-data-html-source-dir))
(defun web-completion-data-tag-doc-file (tag)
(f-expand tag web-completion-data-tag-doc-dir))
(defconst web-completion-data-attr-list-dir
(f-expand "html-attributes-list" web-completion-data-html-source-dir))
(defconst web-completion-data-attr-global-list-file
(f-expand "global" web-completion-data-attr-list-dir))
(defun web-completion-data-attr-list-file (tag)
(f-expand tag web-completion-data-attr-list-dir))
(defconst web-completion-data-attr-doc-dir
(f-expand "html-attributes-short-docs" web-completion-data-html-source-dir))
(defun web-completion-data-attr-global-doc-file (attr)
(f-expand (format "global-%s" attr) web-completion-data-attr-doc-dir))
(defun web-completion-data-attr-doc-file (tag attr)
(f-expand (format "%s-%s" tag attr) web-completion-data-attr-doc-dir))
(defconst web-completion-data-attrv-list-dir
(f-expand "html-attrv-list" web-completion-data-html-source-dir))
(defun web-completion-data-attrv-list-file (tag attr)
(f-expand (format "%s-%s" tag attr) web-completion-data-attrv-list-dir))
(defun web-completion-data-attrv-global-list-file (attr)
(f-expand (format "global-%s" attr) web-completion-data-attrv-list-dir))
(defconst web-completion-data-attrv-doc-dir
(f-expand "html-attrv-docs" web-completion-data-html-source-dir))
(defun web-completion-data-attrv-global-doc-file (attr attrv)
(f-expand (format "global-%s-%s" attr (url-hexify-string attrv))
web-completion-data-attrv-doc-dir))
(defun web-completion-data-attrv-doc-file (tag attr attrv)
(f-expand (format "%s-%s-%s" tag attr (url-hexify-string attrv))
web-completion-data-attrv-doc-dir))
;;; cached data
(defvar ac-html--tags-list nil "The list of tags.")
(defvar ac-html--global-attributes nil "The list of global attrs.")
(defvar ac-html--cached-attributes-alist nil)
;;; helper functions
(defun ac-html--load-list-from-file (filepath)
"Return a list separated by \\n from FILEPATH."
(if (file-exists-p filepath)
(with-current-buffer (find-file-noselect filepath)
(unwind-protect
(split-string
(save-restriction
(widen)
(buffer-substring-no-properties (point-min) (point-max)))
"\n" t)
(kill-buffer)))
nil))
(defun ac-html--read-file (file)
"If file exist, return string of contents, otherwise return nil."
(if (file-exists-p file)
(with-temp-buffer
(insert-file-contents file)
(buffer-string))
nil))
;;; functions
(defun ac-html-default-tags ()
(if ac-html--tags-list
ac-html--tags-list
(setq ac-html--tags-list
(ac-html--load-list-from-file web-completion-data-tag-list-file))))
(defun ac-html-default-attrs (tag)
(unless ac-html--global-attributes
(setq ac-html--global-attributes
(ac-html--load-list-from-file
web-completion-data-attr-global-list-file)))
(let (list attr-file)
(setq attr-file (web-completion-data-attr-list-file tag))
(if (file-exists-p attr-file)
(setq list (ac-html--load-list-from-file
attr-file)))
(append list ac-html--global-attributes)))
(defun ac-html-default-attrvs (tag attr)
(append
(ac-html--load-list-from-file
(web-completion-data-attrv-list-file tag attr))
(ac-html--load-list-from-file
(web-completion-data-attrv-global-list-file attr))))
(defun ac-html-default-tag-doc (tag)
(ac-html--read-file (web-completion-data-tag-doc-file tag)))
(defun ac-html-default-attr-doc (tag attr)
(or (ac-html--read-file (web-completion-data-attr-doc-file tag attr))
(ac-html--read-file (web-completion-data-attr-global-doc-file attr))))
(defun ac-html-default-attrv-doc (tag attr attrv)
(or (ac-html--read-file (web-completion-data-attrv-doc-file tag attr attrv))
(ac-html--read-file
(web-completion-data-attrv-global-doc-file attr attrv))))
(ac-html-define-data-provider 'ac-html-default-data-provider
:tag-func 'ac-html-default-tags
:attr-func 'ac-html-default-attrs
:attrv-func 'ac-html-default-attrvs
:tag-doc-func 'ac-html-default-tag-doc
:attr-doc-func 'ac-html-default-attr-doc
:attrv-doc-func 'ac-html-default-attrv-doc)
(provide 'ac-html-default-data-provider)
;;; ac-html-default-data-provider.el ends here

View File

@ -0,0 +1,15 @@
(define-package "ac-html" "20151005.731" "auto complete source for html tags and attributes"
'((auto-complete "1.4")
(s "1.9")
(f "0.17")
(dash "2.10"))
:keywords
'("html" "auto-complete" "slim" "haml" "jade")
:authors
'(("Zhang Kai Yu" . "yeannylam@gmail.com"))
:maintainer
'("Zhang Kai Yu" . "yeannylam@gmail.com")
:url "https://github.com/cheunghy/ac-html")
;; Local Variables:
;; no-byte-compile: t
;; End:

View File

@ -0,0 +1,17 @@
(require 'ac-html-core)
(defun ac-html-testing-tags ()
'("tag1" "tag2" "tag3"))
(defun ac-html-testing-classes ()
'("class1" "class2"))
(defun ac-html-testing-ids ()
'("id1" "id2" "id3"))
(ac-html-define-data-provider 'ac-html-testing-data-provider
:tag-func 'ac-html-testing-tags
:class-func 'ac-html-testing-classes
:id-func 'ac-html-testing-ids)
(provide 'ac-html-testing-data-provider)

View File

@ -0,0 +1,89 @@
;;; ac-html.el --- auto complete source for html tags and attributes
;; Copyright (C) 2014 - 2015 Zhang Kai Yu
;; Author: Zhang Kai Yu <yeannylam@gmail.com>
;; Version: 0.4.alpha
;; Keywords: html, auto-complete, slim, haml, jade
;; Package-Requires: ((auto-complete "1.4") (s "1.9") (f "0.17") (dash "2.10"))
;; URL: https://github.com/cheunghy/ac-html
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'ac-html-core)
(defun ac-html--inside-attrv ()
"Return t if cursor inside attrv aka string.
Has bug for quoted quote."
(save-match-data
(save-excursion
(re-search-backward "\\w+[\n\t ]*=[\n\t ]*[\"']\\([^\"']*\\)" nil t))
(equal (match-end 1) (point))))
(defun ac-html--inside-comment ()
"Return t if cursor inside comment.
Not implemented yet.")
;;; auto complete HTML for html-mode and web-mode
(defun ac-html-tag-prefix ()
(if (ac-html--inside-attrv)
nil
(save-match-data
(save-excursion
(re-search-backward "<\\([^\n\t >'\"]*\\)" nil t))
(match-beginning 1))))
(defun ac-html-attr-prefix ()
(if (ac-html--inside-attrv)
nil
(save-match-data
(save-excursion
(re-search-backward "<\\w[^>]*[[:space:]]+\\(.*\\)" nil t))
(match-beginning 1))))
(defun ac-html-value-prefix ()
(if (re-search-backward "\\w=[\"]\\([^\"]+[ ]\\|\\)\\(.*\\)" nil t)
(match-beginning 2)))
(defun ac-html-current-tag ()
"Return current html tag user is typing on.
There is a bug if attrv contains string like this <a"
(save-excursion
(save-match-data
(re-search-backward "<\\(\\w+\\)[[:space:]]+" nil t)
(match-string 1))))
(defun ac-html-current-attr ()
"Return current html tag's attribute user is typing on.
There is a bug if attrv contains string like this href="
(save-excursion
(re-search-backward "[^a-z-]\\([a-z-]+\\)[\n\t ]*=" nil t)
(match-string 1)))
(ac-html-define-ac-source "html"
:tag-prefix ac-html-tag-prefix
:attr-prefix ac-html-attr-prefix
:attrv-prefix ac-html-value-prefix
:current-tag-func ac-html-current-tag
:current-attr-func ac-html-current-attr)
(provide 'ac-html)
;;; ac-html.el ends here

Binary file not shown.

View File

@ -0,0 +1,52 @@
;;; ac-jade.el --- auto complete source for html tag and attributes
;; Copyright (C) 2014 Zhang Kai Yu, Olexandr Sydorchuck
;; Author: Zhang Kai Yu <yeannylam@gmail.com>
;; Keywords: html, auto-complete, jade, node
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Configuration:
;;
;;; Code:
(require 'ac-html-core)
(defun ac-jade-current-tag ()
"Return current jade tag user is typing on."
(save-excursion (re-search-backward "^[\t ]*\\(\\w+\\)" nil t))
(match-string 1))
(defun ac-jade-current-attr ()
"Return current html tag's attribute user is typing on."
(save-excursion (re-search-backward "[^a-z-]\\([a-z-]+\\) *=" nil t))
(match-string 1))
(defun ac-jade-attrv-prefix ()
(if (re-search-backward "\\w *= *[\"]\\([^\"]+[ ]\\|\\)\\(.*\\)" nil t)
(match-beginning 2)))
(ac-html-define-ac-source "jade"
:tag-prefix "^[\t ]*\\(.*\\)"
:attr-prefix "\\(?:,\\|(\\)[ ]*\\(.*\\)"
:attrv-prefix ac-jade-attrv-prefix
:current-tag-func ac-jade-current-tag
:current-attr-func ac-jade-current-attr)
(provide 'ac-jade)
;;; ac-jade.el ends here

Binary file not shown.

View File

@ -0,0 +1,154 @@
;;; ac-slim.el --- auto complete source for html tag and attributes
;; Copyright (C) 2015 Zhang Kai Yu
;; Author: Zhang Kai Yu <yeannylam@gmail.com>
;; Keywords: html, auto-complete, slim, ruby
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Configuration:
;;
;;; Code:
(require 'ac-html-core)
(require 's)
(defun ac-slim-inside-ruby-code ()
"Return t if inside ruby code."
(let ((line (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
(numberp (string-match-p "^[\t ]*[-=]" line))))
(defun ac-slim--line-leading-spaces ()
"Return leading space of current line."
(let ((saved-point (point)) (number-of-spaces 0) (cur-point nil))
(goto-char (line-beginning-position))
(setq cur-point (point))
(while (-contains-p '(? ?\t) (char-after cur-point))
(setq number-of-spaces (1+ number-of-spaces))
(setq cur-point (1+ cur-point))
(goto-char cur-point))
(goto-char saved-point)
number-of-spaces))
(defun ac-slim--line-is-block-indicator ()
"Return t if line indicate a non slim block."
(let ((content-of-line (buffer-substring-no-properties
(line-beginning-position) (line-end-position))))
(numberp (string-match-p
"[ \t]*\\(ruby\\|javascript\\|coffee\\):[ \t]*"
content-of-line))))
(defun ac-slim--line-is-empty ()
"Return t if line is empty."
(s-matches-p "^[ \t]*$" (buffer-substring-no-properties
(line-beginning-position)
(line-end-position))))
(defun ac-slim-inside-non-slim-block ()
"Return t if inside ruby block, coffee block."
(catch 'blk
(save-excursion
(let ((min-number-of-leading-spaces (ac-slim--line-leading-spaces)))
(if (ac-slim--line-is-block-indicator)
(throw 'blk t))
(while (not (or (= min-number-of-leading-spaces 0)
(= 1 (line-number-at-pos))))
(forward-line -1)
(if (ac-slim--line-is-empty)
nil
(if (< (ac-slim--line-leading-spaces) min-number-of-leading-spaces)
(progn
(setq min-number-of-leading-spaces (ac-slim--line-leading-spaces))
(if (ac-slim--line-is-block-indicator)
(throw 'blk t))))))))))
(defun ac-slim-tag-prefix ()
(and (not (ac-slim-inside-ruby-code))
(not (ac-slim-inside-non-slim-block))
(save-match-data
(save-excursion
(re-search-backward "\\(^[\t ]*\\|:[\t ]*\\)\\([a-zA-Z]*\\)" nil t)
(match-beginning 2)))))
(defun ac-slim-attr-prefix ()
(and (not (ac-slim-inside-ruby-code))
(not (ac-slim-inside-non-slim-block))
(not (ac-slim-attrv-prefix))
(save-match-data
(save-excursion
(re-search-backward " \\(.*\\)" nil t)
(match-beginning 1)))))
(defun ac-slim-attrv-prefix ()
(and (not (ac-slim-inside-ruby-code))
(not (ac-slim-inside-non-slim-block))
(let (mb2 me2)
(save-excursion
(save-match-data
(if (re-search-backward
"\\w *= *[\"']\\([^\"']+[ ]\\|\\)\\([^\"']*\\)"
(line-beginning-position) t)
(progn
(setq mb2 (match-beginning 2))
(setq me2 (match-end 2))))))
(if (and mb2 (>= me2 (point)))
mb2))))
(defun ac-slim-class-prefix ()
(and (not (ac-slim-inside-ruby-code))
(not (ac-slim-inside-non-slim-block))
(save-match-data
(save-excursion
(re-search-backward "\\(^[\t ]*\\|:[\t ]*\\)\\([a-zA-Z0-9#.]*\\.\\)\\([a-zA-Z0-9]\\)" nil t)
(match-beginning 3)))))
(defun ac-slim-id-prefix ()
(and (not (ac-slim-inside-ruby-code))
(not (ac-slim-inside-non-slim-block))
(save-match-data
(save-excursion
(re-search-backward "\\(^[\t ]*\\|:[\t ]*\\)\\([a-zA-Z0-9.]*#\\)\\([a-zA-Z0-9]\\)" nil t)
(match-beginning 3)))))
(defun ac-slim-current-tag ()
"Return current slim tag user is typing on."
(let* ((line (buffer-substring-no-properties (line-beginning-position)
(line-end-position)))
(match-result (s-match "\\(^[\t ]*\\|:[\t ]*\\)\\(\\w+\\)" line)))
(if match-result
(nth 2 match-result)
"div")))
(defun ac-slim-current-attr ()
"Return current html tag's attribute user is typing on."
(save-excursion (re-search-backward "[^a-z-]\\([a-z-]+\\) *=" nil t))
(match-string 1))
(ac-html-define-ac-source "slim"
:tag-prefix ac-slim-tag-prefix
:attr-prefix ac-slim-attr-prefix
:attrv-prefix ac-slim-attrv-prefix
:class-prefix ac-slim-class-prefix
:id-prefix ac-slim-id-prefix
:current-tag-func ac-slim-current-tag
:current-attr-func ac-slim-current-attr)
(provide 'ac-slim)
;;; ac-slim.el ends here

Binary file not shown.

View File

@ -0,0 +1 @@
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes

View File

@ -0,0 +1,15 @@
download
href
media
ping
rel
target
datafld
datasrc
hreflang
methods
name
rev
shape
type
urn

View File

@ -0,0 +1,15 @@
align
alt
archive
code
codebase
datafld
datasrc
height
hspace
mayscript
name
object
src
vspace
width

View File

@ -0,0 +1,10 @@
alt
coords
download
href
hreflang
media
rel
shape
target
type

View File

@ -0,0 +1,11 @@
autoplay
autobuffer
buffered
controls
loop
mosCurrentSampleOffset
muted
played
preload
src
volume

View File

@ -0,0 +1,2 @@
href
target

View File

@ -0,0 +1,3 @@
color
face
size

View File

@ -0,0 +1 @@
dir

View File

@ -0,0 +1,4 @@
balance
loop
src
volume

View File

@ -0,0 +1,18 @@
onafterprint
onbeforeprint
onbeforeunload
onblur
onerror
onfocus
onhashchange
onlanguagechange
onload
onmessage
onoffline
ononline
onpopstate
onredo
onresize
onstorage
onundo
onunload

View File

@ -0,0 +1,12 @@
autofocus
autocomplete
disabled
form
formaction
formenctype
formmethod
formnovalidate
formtarget
name
type
value

View File

@ -0,0 +1,3 @@
height
moz-opaque
width

View File

@ -0,0 +1,2 @@
bgcolor
span

View File

@ -0,0 +1,2 @@
bgcolor
span

View File

@ -0,0 +1 @@
value

View File

@ -0,0 +1 @@
nowrap

View File

@ -0,0 +1,2 @@
cite
datetime

View File

@ -0,0 +1 @@
compact

View File

@ -0,0 +1,4 @@
height
src
type
width

View File

@ -0,0 +1,3 @@
disabled
form
name

View File

@ -0,0 +1,9 @@
accept-charset
action
autocapitalize
autocomplete
enctype
method
name
novalidate
target

View File

@ -0,0 +1,7 @@
src
name
noresize
scrolling
marginheight
marginwidth
frameborder

View File

@ -0,0 +1,2 @@
cols
rows

View File

@ -0,0 +1,20 @@
accesskey
class
contenteditable
contextmenu
data-
dir
draggable
dropzone
hidden
id
itemid
itemprop
itemref
itemscope
itemtype
lang
spellcheck
style
tabindex
title

View File

@ -0,0 +1 @@
color

View File

@ -0,0 +1 @@
manifest

View File

@ -0,0 +1,8 @@
allowfullscreen
height
name
sandbox
seamless
src
srcdoc
width

View File

@ -0,0 +1,9 @@
alt
crossorigin
height
ismap
src
sizes
srcset
width
usemap

View File

@ -0,0 +1,38 @@
type
accept
autocapitalize
mozactionhint
autocomplete
autocorrect
autofocus
autosave
checked
disabled
form
formaction
formenctype
formmethod
formnovalidate
formtarget
height
incremental
inputmode
list
max
maxlength
min
minlength
multiple
name
pattern
placeholder
readonly
required
selectionDirection
size
spellcheck
src
step
value
width
x-moz-errormessage

View File

@ -0,0 +1,2 @@
cite
datetime

View File

@ -0,0 +1,2 @@
prompt
action

View File

@ -0,0 +1,6 @@
autofocus
challenge
disabled
form
keytype
name

View File

@ -0,0 +1,3 @@
accesskey
for
form

View File

@ -0,0 +1 @@
value

View File

@ -0,0 +1,11 @@
crossorigin
use-credentials
disabled
href
hreflang
media
methods
rel
sizes
target
type

View File

@ -0,0 +1 @@
name

View File

@ -0,0 +1,16 @@
behavior
bgcolor
direction
height
hspace
loop
scrollamount
scrolldelay
truespeed
vspace
width
onbounce
onfinish
onstart
start
stop

View File

@ -0,0 +1,2 @@
label
type

View File

@ -0,0 +1,8 @@
checked
command
default
disabled
icon
label
radiogroup
type

View File

@ -0,0 +1,5 @@
name
charset
itemprop
http-equiv
content

View File

@ -0,0 +1,7 @@
value
min
max
low
high
optimum
form

View File

@ -0,0 +1,8 @@
data
form
height
name
type
typemustmatch
usemap
width

View File

@ -0,0 +1,4 @@
compact
reversed
start
type

View File

@ -0,0 +1,2 @@
disabled
label

View File

@ -0,0 +1,4 @@
disabled
label
selected
value

View File

@ -0,0 +1,3 @@
for
form
name

View File

@ -0,0 +1,2 @@
max
value

View File

@ -0,0 +1 @@
cite

View File

@ -0,0 +1,5 @@
async
src
type
defer
crossorigin

View File

@ -0,0 +1,7 @@
autofocus
disabled
form
multiple
name
required
size

View File

@ -0,0 +1,5 @@
sizes
src
srcset
type
media

View File

@ -0,0 +1,5 @@
type
size
width
height
align

View File

@ -0,0 +1,5 @@
type
media
scoped
title
disabled

View File

@ -0,0 +1,3 @@
colspan
headers
rowspan

View File

@ -0,0 +1,18 @@
autocapitalize
autocomplete
autofocus
cols
disabled
form
maxlength
minlength
name
placeholder
readonly
required
rows
selectionDirection
selectionEnd
selectionStart
spellcheck
wrap

View File

@ -0,0 +1,4 @@
colspan
headers
rowspan
scope

View File

@ -0,0 +1 @@
datetime

View File

@ -0,0 +1,5 @@
default
kind
label
src
srclang

View File

@ -0,0 +1,12 @@
autoplay
buffered
controls
crossorigin
height
loop
muted
played
preload
poster
src
width

View File

@ -0,0 +1,7 @@
charset [Obsolete since HTML5]
This attribute defines the character encoding of the linked resource. The value is a space- and/or comma-delimited list of character sets as defined in RFC 2045. The default value is ISO-8859-1.
Usage note:
This attribute is obsolete in HTML5 and should not be used by authors. To achieve its effect, use the HTTP Content-Type header on the linked resource.

View File

@ -0,0 +1,3 @@
coords [HTML4 only] [Obsolete since HTML5]
For use with object shapes, this attribute uses a comma-separated list of numbers to define the coordinates of the object on the page.

Some files were not shown because too many files have changed in this diff Show More