Compare commits
1 Commits
master
...
warn-key-r
Author | SHA1 | Date | |
---|---|---|---|
4e666d5c6b |
2
.achievements
Normal file
2
.achievements
Normal file
File diff suppressed because one or more lines are too long
35
.gitignore
vendored
35
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
/customizations.el
|
||||
*~
|
||||
/session*
|
||||
/tramp
|
||||
@ -18,12 +17,6 @@
|
||||
/smex-items
|
||||
/var/
|
||||
/anaconda-mode/
|
||||
/.last-package-update-day
|
||||
/eln-cache
|
||||
/.lsp-session-v1
|
||||
/.dap-breakpoints
|
||||
/elpy
|
||||
|
||||
# All hail use-package!
|
||||
/elpa/
|
||||
|
||||
@ -36,30 +29,4 @@
|
||||
/.sx/
|
||||
|
||||
# Newsticker
|
||||
/newsticker
|
||||
|
||||
# The “compiled” version of the Org configuration
|
||||
/configuration.el
|
||||
/bookmarks
|
||||
|
||||
/org-caldav-*.el
|
||||
|
||||
# Forge database
|
||||
/forge-database.sqlite
|
||||
/forge-database-v*.sql
|
||||
/forge-database-v*.sqlite
|
||||
|
||||
# request.el cookie jars
|
||||
/request/curl-cookie-jar
|
||||
|
||||
# Quelpa stuff
|
||||
/quelpa
|
||||
|
||||
# Transient history
|
||||
/transient/history.el
|
||||
|
||||
# Mastodon token list
|
||||
/mastodon.plstore
|
||||
/org-roam.db
|
||||
/.org-id-locations
|
||||
/projects
|
||||
/newsticker
|
98
.mc-lists.el
98
.mc-lists.el
@ -3,72 +3,38 @@
|
||||
|
||||
(setq mc/cmds-to-run-for-all
|
||||
'(
|
||||
avy-goto-char
|
||||
backward-sexp
|
||||
c-electric-brace
|
||||
c-electric-colon
|
||||
c-electric-paren
|
||||
c-electric-semi&comma
|
||||
c-electric-star
|
||||
c-indent-line-or-region
|
||||
delete-indentation
|
||||
downcase-region
|
||||
drag-stuff-down
|
||||
electric-newline-and-maybe-indent
|
||||
forward-sexp
|
||||
gpolonkai/duplicate-line
|
||||
gpolonkai/move-to-beginning-of-line
|
||||
gpolonkai/move-to-end-of-line
|
||||
gpolonkai/org-space-key
|
||||
hungry-delete-backward
|
||||
hungry-delete-forward
|
||||
indent-for-tab-command
|
||||
kill-region
|
||||
kill-sexp
|
||||
kill-visual-line
|
||||
kmacro-end-or-call-macro
|
||||
magit-status
|
||||
org-cycle
|
||||
org-delete-indentation
|
||||
org-end-of-line
|
||||
org-force-self-insert
|
||||
org-kill-line
|
||||
org-meta-return
|
||||
org-return
|
||||
org-self-insert-command
|
||||
org-yank
|
||||
overwrite-mode
|
||||
sp-backward-delete-char
|
||||
sp-backward-kill-word
|
||||
sp-delete-char
|
||||
sp-kill-hybrid-sexp
|
||||
sp-kill-region
|
||||
sp-kill-word
|
||||
sp-remove-active-pair-overlay
|
||||
sp-rewrap-sexp
|
||||
sp-unwrap-sexp
|
||||
toggle-char-case
|
||||
upcase-region
|
||||
wdired--self-insert
|
||||
yaml-electric-dash-and-dot
|
||||
))
|
||||
avy-goto-char
|
||||
c-electric-brace
|
||||
c-electric-semi&comma
|
||||
c-indent-line-or-region
|
||||
electric-newline-and-maybe-indent
|
||||
gpolonkai/move-to-beginning-of-line
|
||||
gpolonkai/move-to-end-of-line
|
||||
hungry-delete-backward
|
||||
hungry-delete-forward
|
||||
indent-for-tab-command
|
||||
kill-region
|
||||
org-cycle
|
||||
org-end-of-line
|
||||
org-kill-line
|
||||
org-return
|
||||
org-self-insert-command
|
||||
org-space-key
|
||||
sp-backward-delete-char
|
||||
sp-backward-kill-word
|
||||
sp-delete-char
|
||||
))
|
||||
|
||||
(setq mc/cmds-to-run-once
|
||||
'(
|
||||
ace-jump-done
|
||||
ace-jump-move
|
||||
ace-mc-add-char
|
||||
ace-mc-add-multiple-cursors
|
||||
ace-mc-add-single-cursor
|
||||
ace-mc-do-keyboard-reset
|
||||
ace-mc-quick-exchange
|
||||
counsel-M-x
|
||||
drag-stuff-right
|
||||
end-of-buffer
|
||||
helm-M-x
|
||||
helm-confirm-and-exit-minibuffer
|
||||
helm-find-files
|
||||
smartparens-strict-mode
|
||||
suspend-frame
|
||||
yaml-electric-backspace
|
||||
))
|
||||
ace-jump-move
|
||||
ace-mc-add-char
|
||||
ace-mc-add-multiple-cursors
|
||||
ace-mc-add-single-cursor
|
||||
ace-mc-do-keyboard-reset
|
||||
drag-stuff-right
|
||||
end-of-buffer
|
||||
helm-M-x
|
||||
helm-find-files
|
||||
smartparens-strict-mode
|
||||
))
|
||||
|
3271
configuration.org
3271
configuration.org
File diff suppressed because it is too large
Load Diff
155
customizations.el
Normal file
155
customizations.el
Normal file
@ -0,0 +1,155 @@
|
||||
(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.
|
||||
'(background-color "#7f7f7f")
|
||||
'(background-mode dark)
|
||||
'(blink-cursor-mode t)
|
||||
'(column-number-mode t)
|
||||
'(cursor-color "#5c5cff")
|
||||
'(cursor-type (quote bar))
|
||||
'(custom-enabled-themes (quote (tango-dark)))
|
||||
'(custom-file (concat user-emacs-directory "customizations.el"))
|
||||
'(custom-safe-themes
|
||||
(quote
|
||||
("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" default)))
|
||||
'(echo-keystrokes 0.1)
|
||||
'(fill-column 76)
|
||||
'(foreground-color "#5c5cff")
|
||||
'(indent-tabs-mode nil)
|
||||
'(indicate-empty-lines t)
|
||||
'(inhibit-startup-echo-area-message (user-login-name))
|
||||
'(inhibit-startup-screen t)
|
||||
'(initial-scratch-message nil)
|
||||
'(package-selected-packages
|
||||
(quote
|
||||
(ace-mc
|
||||
ace-popup-menu
|
||||
ace-window
|
||||
achievements
|
||||
ag
|
||||
alert
|
||||
anaconda-mode
|
||||
anzu
|
||||
auto-highlight-symbol
|
||||
auto-package-update
|
||||
auto-virtualenv
|
||||
avy
|
||||
beacon
|
||||
bind-key
|
||||
cheatsheet
|
||||
coffee-mode
|
||||
command-log-mode
|
||||
company
|
||||
company-anaconda
|
||||
company-c-headers
|
||||
company-emoji
|
||||
company-restclient
|
||||
company-shell
|
||||
diminish
|
||||
dired-k
|
||||
drag-stuff
|
||||
electric-case
|
||||
electric-spacing
|
||||
emamux
|
||||
eshell-fringe-status
|
||||
eshell-prompt-extras
|
||||
expand-region
|
||||
fill-column-indicator
|
||||
flycheck
|
||||
flycheck-pkg-config
|
||||
flymake-python-pyflakes
|
||||
focus
|
||||
form-feed
|
||||
ggtags
|
||||
git-gutter-fringe
|
||||
git-messenger
|
||||
git-timemachine
|
||||
gitconfig-mode
|
||||
gitignore-mode
|
||||
gitlab
|
||||
gnugo
|
||||
gobgen
|
||||
google
|
||||
goto-last-change
|
||||
helm
|
||||
helm-ag
|
||||
helm-c-yasnippet
|
||||
helm-chrome
|
||||
helm-company
|
||||
helm-descbinds
|
||||
helm-describe-modes
|
||||
helm-flycheck
|
||||
helm-flyspell
|
||||
helm-github-stars
|
||||
helm-google
|
||||
helm-gtags
|
||||
helm-hunks
|
||||
helm-projectile
|
||||
helm-pydoc
|
||||
helm-smex
|
||||
helm-swoop
|
||||
helm-unicode
|
||||
highlight-indent-guides
|
||||
hl-todo
|
||||
hungarian-holidays
|
||||
hungry-delete
|
||||
hyde
|
||||
id-manager
|
||||
identica-mode
|
||||
jinja2-mode
|
||||
js2-mode
|
||||
json-mode
|
||||
kanban
|
||||
magit
|
||||
magit-gerrit
|
||||
magithub
|
||||
markdown-mode
|
||||
mc-extras
|
||||
multiple-cursors
|
||||
ng2-mode
|
||||
nyan-mode
|
||||
nyan-prompt
|
||||
org
|
||||
org-bullets
|
||||
org-jekyll
|
||||
org-projectile
|
||||
org-random-todo
|
||||
org-rtm
|
||||
origami
|
||||
plantuml-mode
|
||||
projectile
|
||||
rainbow-delimiters
|
||||
rainbow-mode
|
||||
restclient
|
||||
restclient-helm
|
||||
sass-mode
|
||||
smart-mode-line
|
||||
smart-mode-line-powerline-theme
|
||||
smartparens
|
||||
spinner
|
||||
sx
|
||||
typescript-mode
|
||||
use-package
|
||||
vala-mode
|
||||
vala-snippets
|
||||
wakatime-mode
|
||||
xlicense
|
||||
yaml-mode
|
||||
yasnippet
|
||||
zone-nyan
|
||||
zygospore)))
|
||||
'(sgml-basic-offset 4)
|
||||
'(show-trailing-whitespace t)
|
||||
'(tab-width 4))
|
||||
(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.
|
||||
'(default ((t (:family "Hack" :foundry "simp" :slant normal :weight normal :height 98 :width normal))))
|
||||
'(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 2.0))))
|
||||
'(hl-line ((t (:inherit nil :background "gray25"))))
|
||||
'(trailing-whitespace ((t (:inherit nil :background "red1"))))
|
||||
'(whitespace-line ((t (:inherit nil :background "orange4")))))
|
@ -1 +0,0 @@
|
||||
alias git git --no-pager $*
|
@ -1,2 +1 @@
|
||||
03618 Thu Aug 16 09:29:39 2018 Gergely Polonkai <gergely@polonkai.eu>
|
||||
02667 Wed Oct 5 09:52:44 2016 Gergely Polonkai <gergely@polonkai.eu>
|
||||
|
@ -1 +0,0 @@
|
||||
00000 Thu Aug 16 09:43:46 2018 Gergely Polonkai <gergely@polonkai.eu>
|
166
lisp/buf-manipulation.el
Normal file
166
lisp/buf-manipulation.el
Normal file
@ -0,0 +1,166 @@
|
||||
;; Some custom functions for buffer content manipulation
|
||||
|
||||
(defun delete-current-line ()
|
||||
"Kill the whole line on which point is"
|
||||
(interactive)
|
||||
|
||||
(beginning-of-line)
|
||||
(kill-line 1))
|
||||
|
||||
(defun copy-func-prototype ()
|
||||
"Copy the current function's prototype to the kill-ring"
|
||||
|
||||
(interactive)
|
||||
|
||||
(save-excursion
|
||||
(beginning-of-defun)
|
||||
(setq protocopy-begin (point))
|
||||
(forward-list)
|
||||
(setq protocopy-end (point))
|
||||
(kill-ring-save protocopy-begin protocopy-end)))
|
||||
|
||||
(defun duplicate-line()
|
||||
"Duplicate line at point."
|
||||
|
||||
(interactive)
|
||||
|
||||
(save-excursion
|
||||
(move-beginning-of-line 1)
|
||||
(kill-line)
|
||||
(yank)
|
||||
(open-line 1)
|
||||
(next-line 1)
|
||||
(yank)))
|
||||
|
||||
(defun toggle-char-case (arg-move-point)
|
||||
"Toggle the case of the char after point. Based on Xah's toggle letter
|
||||
case defun version 2015-12-22
|
||||
|
||||
URL `http://ergoemacs.org/emacs/modernization_upcase-word.html'
|
||||
Version 2016-02-16"
|
||||
(interactive "P")
|
||||
(let ((case-fold-search nil))
|
||||
(cond
|
||||
((looking-at "[[:lower:]]") (upcase-region (point) (1+ (point))))
|
||||
((looking-at "[[:upper:]]") (downcase-region (point) (1+ (point)))))
|
||||
(cond
|
||||
(arg-move-point (right-char)))))
|
||||
|
||||
; Copied from http://whattheemacsd.com/editing-defuns.el-01.html
|
||||
(defun open-line-below ()
|
||||
"Open a new line below point."
|
||||
|
||||
(interactive)
|
||||
|
||||
(end-of-line)
|
||||
(newline)
|
||||
(indent-for-tab-command))
|
||||
|
||||
(defun open-line-above ()
|
||||
"Open a new line above point."
|
||||
|
||||
(interactive)
|
||||
|
||||
(beginning-of-line)
|
||||
(newline)
|
||||
(forward-line -1)
|
||||
(indent-for-tab-command))
|
||||
|
||||
; Copied from http://whattheemacsd.com/file-defuns.el-01.html
|
||||
(defun rename-current-buffer-file ()
|
||||
"Renames current buffer and file it is visiting."
|
||||
(interactive)
|
||||
|
||||
(let ((name (buffer-name))
|
||||
(filename (buffer-file-name)))
|
||||
(if (not (and filename (file-exists-p filename)))
|
||||
(error "Buffer '%s' is not visiting a file!" name)
|
||||
(let ((new-name (read-file-name "New name: " filename)))
|
||||
(if (get-buffer new-name)
|
||||
(error "A buffer named '%s' already exists!" new-name)
|
||||
(rename-file filename new-name 1)
|
||||
(rename-buffer new-name)
|
||||
(set-visited-file-name new-name)
|
||||
; TODO: this is suspicious for me…
|
||||
(set-buffer-modified-p nil)
|
||||
(message "File '%s' successfully renamed to '%s'"
|
||||
name (file-name-nondirectory new-name)))))))
|
||||
|
||||
; Copied from http://whattheemacsd.com/file-defuns.el-02.html
|
||||
(defun delete-current-buffer-file ()
|
||||
"Removes file connected to current buffer and kills the
|
||||
buffer."
|
||||
(interactive)
|
||||
|
||||
(let ((filename (buffer-file-name))
|
||||
(name (buffer-name))
|
||||
(buffer (current-buffer)))
|
||||
(if (not (and filename (file-exists-p filename)))
|
||||
(kill-buffer buffer)
|
||||
(when (yes-or-no-p "Are you sure you want to remove this file? ")
|
||||
(delete-file filename)
|
||||
(kill-buffer buffer)
|
||||
(message "File '%s' successfully removed" filename)))))
|
||||
|
||||
; delete-char or close eshell
|
||||
; Copied from https://ryuslash.org/posts/C-d-to-close-eshell.html
|
||||
(defun eshell-C-d ()
|
||||
"Either call `delete-char' interactively or quit."
|
||||
(interactive)
|
||||
|
||||
(condition-case err
|
||||
(call-interactively #'delete-char)
|
||||
(error (if (and (eq (car err) 'end-of-buffer)
|
||||
(looking-back eshell-prompt-regexp))
|
||||
(kill-buffer)
|
||||
(signal (car err) (cdr err))))))
|
||||
|
||||
(defun æ-kill-or-copy-whole-line (kill)
|
||||
"Kill or copy the whole line point is on.
|
||||
|
||||
If KILL is non-nil, the line gets killed. Otherwise, it gets just
|
||||
copied to the kill-ring."
|
||||
(interactive "P")
|
||||
|
||||
(if kill
|
||||
(kill-whole-line)
|
||||
(let ((beginning (progn (beginning-of-line) (point)))
|
||||
(end (progn (end-of-line) (point))))
|
||||
(copy-region-as-kill beginning end))))
|
||||
|
||||
(defun gpolonkai/move-to-beginning-of-line ()
|
||||
"Move to different beginnings of the line; in order: beginning
|
||||
of the visual line if `visual-line-mode' is active, the first
|
||||
non-whitespace (indentation), the actual beginning of the line.
|
||||
This function will jump between the first character and the
|
||||
indentation if used multiple times.
|
||||
|
||||
Inspired by Bozhidar Batsov's solution:
|
||||
http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/"
|
||||
(interactive)
|
||||
(let ((last-pos (point)))
|
||||
(when visual-line-mode
|
||||
(beginning-of-visual-line))
|
||||
(when (= (point) last-pos)
|
||||
(back-to-indentation))
|
||||
(when (= (point) last-pos)
|
||||
(beginning-of-line))
|
||||
(when (and (eq major-mode 'org-mode)
|
||||
(= (point) last-pos))
|
||||
(org-beginning-of-line))
|
||||
(when (= (point) last-pos)
|
||||
(back-to-indentation))))
|
||||
|
||||
(defun gpolonkai/move-to-end-of-line ()
|
||||
"Move to the end of the line. If `visual-line-mode' is active,
|
||||
jump to the end of the visual line first. The jump to the
|
||||
actual end of the line."
|
||||
(interactive)
|
||||
(let ((last-pos (point)))
|
||||
(when visual-line-mode
|
||||
(end-of-visual-line))
|
||||
(when (= (point) last-pos)
|
||||
(end-of-line))
|
||||
(when (and (eq major-mode 'org-mode)
|
||||
(= (point) last-pos))
|
||||
(org-end-of-line))))
|
34
lisp/enclose-string.el
Normal file
34
lisp/enclose-string.el
Normal file
@ -0,0 +1,34 @@
|
||||
(defun æ-enclose-region (character &optional start end)
|
||||
"Enclose region in CHARACTER. If region is empty, simply inserts
|
||||
CHARACTER two times and moves point between them.
|
||||
|
||||
If character is present in `insert-pair-alist', this function
|
||||
will enclose region in the corresponding pair. In this case,
|
||||
CHARACTER must be the opening member of the pair."
|
||||
|
||||
(interactive "cWhat character? \nr")
|
||||
|
||||
(setq open character close character)
|
||||
|
||||
(let ((pair (assq character insert-pair-alist)))
|
||||
(if pair
|
||||
(if (nth 2 pair)
|
||||
(setq open (nth 1 pair) close (nth 2 pair))
|
||||
(setq open (nth 0 pair) close (nth 1 pair)))))
|
||||
|
||||
(unless (and open close)
|
||||
(setq open character)
|
||||
(setq close character))
|
||||
|
||||
(unless (use-region-p)
|
||||
(setq start (point) end (point)))
|
||||
|
||||
(save-excursion
|
||||
(goto-char end)
|
||||
(insert-char close)
|
||||
|
||||
(goto-char start)
|
||||
(insert-char open))
|
||||
|
||||
(unless (use-region-p)
|
||||
(forward-char)))
|
24
lisp/file-manip.el
Normal file
24
lisp/file-manip.el
Normal file
@ -0,0 +1,24 @@
|
||||
(defun open-this-file-as-other-user (user)
|
||||
"Edit current file as USER, using `tramp' and `sudo'. If the current
|
||||
buffer is not visiting a file, prompt for a file name."
|
||||
(interactive "sEdit as user (default: root): ")
|
||||
(when (string= "" user)
|
||||
(setq user "root"))
|
||||
(let* ((filename (or buffer-file-name
|
||||
(read-file-name (format "Find file (as %s): "
|
||||
user))))
|
||||
(tramp-path (concat (format "/sudo:%s@localhost:" user) filename)))
|
||||
(if buffer-file-name
|
||||
(find-alternate-file tramp-path)
|
||||
(find-file tramp-path))))
|
||||
|
||||
(defun gpolonkai/visit-init-file ()
|
||||
"Open the init file."
|
||||
(interactive)
|
||||
(find-file-other-window user-init-file))
|
||||
|
||||
(defun gpolonkai/visit-org-index ()
|
||||
"Visit the root of Org-mode notes."
|
||||
(interactive)
|
||||
(find-file-other-window (concat (file-name-as-directory org-directory)
|
||||
"index.org")))
|
@ -1,94 +0,0 @@
|
||||
;;; flycheck-swagger-tools --- Flycheck checker for swagger-tools.
|
||||
|
||||
;; Copyright (C) 2017 Marc-André Goyette
|
||||
;; Author: Marc-André Goyette <goyette.marcandre@gmail.com>
|
||||
;; URL: https://github.com/magoyette/flycheck-swagger-tools
|
||||
;; Version: 0.1.0
|
||||
;; Package-Requires: ((emacs "25"))
|
||||
;; Keywords: swagger
|
||||
|
||||
;; 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.
|
||||
|
||||
;; For a full copy of the GNU General Public License
|
||||
;; see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; flycheck-swagger-tools provides a Flycheck checker for swagger-tools.
|
||||
;; This allows to validate Swagger YAML and JSON files.
|
||||
|
||||
;; The checker can be activating by requiring this package.
|
||||
|
||||
;; (require 'flycheck-swagger-tools)
|
||||
|
||||
;; By default, only the first 4000 characters of a file are scanned to
|
||||
;; find the swagger 2.0 element. To avoid stack overflow in Emacs
|
||||
;; multi-line regex, this value is necessary. The defcustom
|
||||
;; swagger-tools-predicate-regexp-match-limit can be used to change this
|
||||
;; limit. That could be necessary for YAML files with long initial comments.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'flycheck)
|
||||
|
||||
(defgroup swagger-tools nil
|
||||
"Validate swagger files with swagger-tools."
|
||||
:group 'swagger
|
||||
:prefix "swagger-tools-")
|
||||
|
||||
(defcustom swagger-tools-predicate-regexp-match-limit 4000
|
||||
"Defines the number of characters that will be scanned at the beginning of a
|
||||
buffer to find the swagger 2.0 element."
|
||||
:type 'integer
|
||||
:group 'swagger-tools)
|
||||
|
||||
;;;###autoload
|
||||
(flycheck-define-checker swagger-tools
|
||||
"A checker that uses swagger tools to validate Swagger2 JSON and YAML files.
|
||||
See URL `https://github.com/apigee-127/swagger-tools'."
|
||||
:command ("swagger-tools" "validate" source)
|
||||
:predicate
|
||||
(lambda ()
|
||||
(string-match
|
||||
"\\(.\\|\n\\)*\\([[:space:]]\\|\"\\|\\'\\)*swagger\\([[:space:]]\\|\"\\|\\'\\)*:[[:space:]]*[\"\\']2.0[\"\\'].*"
|
||||
;; Need to avoid stack overflow for multi-line regex
|
||||
(buffer-substring 1 (min (buffer-size)
|
||||
swagger-tools-predicate-regexp-match-limit))))
|
||||
:error-patterns
|
||||
((warning line-start " " (message (one-or-more not-newline)
|
||||
"is not used"
|
||||
(one-or-more not-newline))
|
||||
line-end)
|
||||
;; js-yaml error with position
|
||||
(error line-start " error: " (message) " at line " line ", column " column ":" line-end)
|
||||
;; js-yaml error without position
|
||||
(error line-start " error: " (message) ": " (one-or-more not-newline) line-end)
|
||||
;; swagger-tools error (always contain a # symbol in the message)
|
||||
(error line-start
|
||||
" "
|
||||
(message (optional (one-or-more not-newline))
|
||||
(one-or-more "#")
|
||||
(one-or-more not-newline))
|
||||
line-end))
|
||||
:error-filter
|
||||
;; Add line number 1 if the error has no line number
|
||||
(lambda (errors)
|
||||
(let ((errors (flycheck-sanitize-errors errors)))
|
||||
(dolist (err errors)
|
||||
(unless (flycheck-error-line err)
|
||||
(setf (flycheck-error-line err) 1)))
|
||||
errors))
|
||||
:modes (json-mode openapi-yaml-mode yaml-mode))
|
||||
|
||||
(add-to-list 'flycheck-checkers 'swagger-tools)
|
||||
|
||||
(provide 'flycheck-swagger-tools)
|
||||
;;; flycheck-swagger-tools.el ends here
|
24
lisp/frame-manip.el
Normal file
24
lisp/frame-manip.el
Normal file
@ -0,0 +1,24 @@
|
||||
;; Copied from http://emacs-doctor.com/emacs-strip-tease.html
|
||||
|
||||
(defvar hidden-mode-line-mode nil)
|
||||
(defvar hide-mode-line nil)
|
||||
|
||||
(define-minor-mode hidden-mode-line-mode
|
||||
"Minor mode to hide the mode-line in the current buffer."
|
||||
:init-value nil
|
||||
:global nil
|
||||
:variable hidden-mode-line-mode
|
||||
:group 'editing-basics
|
||||
(if hidden-mode-line-mode
|
||||
(setq hide-mode-line mode-line-format
|
||||
mode-line-format nil)
|
||||
(setq mode-line-format hide-mode-line
|
||||
hide-mode-line nil))
|
||||
(force-mode-line-update)
|
||||
(redraw-display)
|
||||
(when (and (called-interactively-p 'interactive)
|
||||
hidden-mode-line-mode)
|
||||
(run-with-idle-timer
|
||||
0 nil 'message
|
||||
(concat "Hidden Mode Line Mode enabled. "
|
||||
"Use M-x hidden-mode-line-mode to make mode-line appear."))))
|
65
lisp/gnu-c-header.el
Normal file
65
lisp/gnu-c-header.el
Normal file
@ -0,0 +1,65 @@
|
||||
;;; gnu-c-header.el --- function to add a header to the C files licensed under the GPL
|
||||
;; Author: Gergely Polonkai <gergely@polonkai.eu>
|
||||
;; Copyright: public domain
|
||||
;; URL: http://gergely.polonkai.eu/blog/2014/09/26/emacs-adding-gnu-c-headers
|
||||
;; Keywords: gnu, c, header, helper, utilities
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun file-name-base-with-extension (&optional filename)
|
||||
"Return the base name of the FILENAME without its directory path.
|
||||
FILENAME defaults to `buffer-file-name'."
|
||||
(file-name-nondirectory (or filename (buffer-file-name))))
|
||||
|
||||
(defun add-gnu-c-header (progname purpose)
|
||||
"Add a GNU GPL header to the current buffer"
|
||||
(interactive "sProgram name (ie: MyProgram): \nsPurpose of the file (ie: string utility functions): ")
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(insert (concat
|
||||
"/* "
|
||||
(file-name-base-with-extension buffer-file-name)
|
||||
" - "
|
||||
purpose
|
||||
" for "
|
||||
progname
|
||||
"\n"
|
||||
" *\n"
|
||||
" * Copyright (C) "
|
||||
(format-time-string "%Y" (current-time))
|
||||
" "
|
||||
(user-full-name)
|
||||
"\n"
|
||||
" *\n"))
|
||||
(let ((start (point)))
|
||||
(insert (concat
|
||||
" * "
|
||||
progname
|
||||
" is \n * 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."))
|
||||
(let ((end (point)))
|
||||
(fill-region start end)))
|
||||
(insert (concat
|
||||
"\n"
|
||||
" *\n"))
|
||||
(let ((start (point)))
|
||||
(insert (concat
|
||||
" * "
|
||||
progname
|
||||
" is \n * 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."))
|
||||
(let ((end (point)))
|
||||
(fill-region start end)))
|
||||
(insert (concat
|
||||
"\n"
|
||||
" *\n"))
|
||||
(let ((start (point)))
|
||||
(insert " * You \n * should have received a copy of the GNU General Public License along with this software; if not, see <http://www.gnu.org/licenses/>.")
|
||||
(let ((end (point)))
|
||||
(fill-region start end)))
|
||||
(insert (concat
|
||||
"\n"
|
||||
" */\n"))
|
||||
))
|
||||
|
||||
(provide 'gnu-c-header)
|
||||
|
||||
;;; gnu-c-header.el ends here
|
@ -1,27 +0,0 @@
|
||||
;;; gp-mouse --- Extra mouse functionality
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
(require 'mouse)
|
||||
|
||||
(defun gpolonkai/event-in-current-window-p (event)
|
||||
"Check if EVENT happened in the current window."
|
||||
(let ((current-window (selected-window))
|
||||
(event-window (posn-window (event-start event))))
|
||||
(eq current-window event-window)))
|
||||
|
||||
(defun gpolonkai/mouse-set-point (click &optional promote-to-region)
|
||||
"Set mouse position.
|
||||
|
||||
If CLICK happened in an inactive window, select that window without setting point"
|
||||
(interactive "e\np")
|
||||
(if (gpolonkai/event-in-current-window-p click)
|
||||
(call-interactively 'mouse-set-point)
|
||||
(call-interactively 'mouse-select-window)))
|
||||
|
||||
(global-set-key [mouse-1] 'mouse-select-window-or-set-point)
|
||||
(global-unset-key [down-mouse-1])
|
||||
|
||||
(provide 'gp-mouse)
|
||||
;;; gp-mouse.el ends here
|
27
lisp/gpolonkai-misc.el
Normal file
27
lisp/gpolonkai-misc.el
Normal file
@ -0,0 +1,27 @@
|
||||
(defun warn-key-rebind (keymap key new-def)
|
||||
"Warn if a key is being rebound."
|
||||
(let ((global-def (global-key-binding key))
|
||||
(local-def (local-key-binding key))
|
||||
(minor-defs (minor-mode-key-binding key))
|
||||
(key-desc (key-description key)))
|
||||
(when (and global-def
|
||||
(not (numberp global-def))
|
||||
(not (equal global-def new-def)))
|
||||
(warn "'%s' from the global keymap is being rebound from '%s' to '%s'"
|
||||
key-desc
|
||||
global-def
|
||||
new-def))
|
||||
(when (and local-def
|
||||
(not (numberp local-def))
|
||||
(not (equal local-def new-def)))
|
||||
(warn "'%s' from the local keymap is being rebound from '%s' to '%s'"
|
||||
key-desc
|
||||
local-def
|
||||
new-def))
|
||||
(when minor-defs
|
||||
(dolist (binding minor-defs)
|
||||
(warn "'%s' from '%s' keymap is being rebound from '%s' to '%s'"
|
||||
key-desc
|
||||
(car binding)
|
||||
(cdr binding)
|
||||
new-def)))))
|
@ -1,17 +0,0 @@
|
||||
(setq-default
|
||||
mode-line-format
|
||||
("%e"
|
||||
mode-line-front-space
|
||||
mode-line-mule-info
|
||||
mode-line-client
|
||||
mode-line-modified
|
||||
mode-line-remote
|
||||
mode-line-frame-identification
|
||||
mode-line-buffer-identification
|
||||
" "
|
||||
mode-line-position
|
||||
(vc-mode vc-mode)
|
||||
" "
|
||||
mode-line-modes
|
||||
mode-line-misc-info
|
||||
mode-line-end-spaces))
|
102
lisp/package-manip.el
Normal file
102
lisp/package-manip.el
Normal file
@ -0,0 +1,102 @@
|
||||
;;; package-manip.el --- Utility functions to check if package upgrades are available
|
||||
|
||||
;;; Commentary:
|
||||
;; I should add one.
|
||||
|
||||
;; Credits go to http://emacs.stackexchange.com/a/16407/507
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defun package-upgrade-all ()
|
||||
"Upgrade all packages automatically without showing *Packages* buffer."
|
||||
(interactive)
|
||||
(package-refresh-contents)
|
||||
(let (upgrades)
|
||||
(cl-flet ((get-version (name where)
|
||||
(let ((pkg (cadr (assq name where))))
|
||||
(when pkg
|
||||
(package-desc-version pkg)))))
|
||||
(dolist (package (mapcar #'car package-alist))
|
||||
(let ((in-archive (get-version package package-archive-contents)))
|
||||
(when (and in-archive
|
||||
(version-list-< (get-version package package-alist)
|
||||
in-archive))
|
||||
(push (cadr (assq package package-archive-contents))
|
||||
upgrades)))))
|
||||
(if upgrades
|
||||
(when (yes-or-no-p
|
||||
(message "Upgrade %d package%s (%s)? "
|
||||
(length upgrades)
|
||||
(if (= (length upgrades) 1) "" "s")
|
||||
(mapconcat #'package-desc-full-name upgrades ", ")))
|
||||
(save-window-excursion
|
||||
(dolist (package-desc upgrades)
|
||||
(let ((old-package (cadr (assq (package-desc-name package-desc)
|
||||
package-alist))))
|
||||
(package-install package-desc)
|
||||
(package-delete old-package)))))
|
||||
(message "All packages are up to date"))))
|
||||
|
||||
(defun check-todays-package-upgrade-p (&optional no-save)
|
||||
"Check if automatic package upgrade has been performed today.
|
||||
|
||||
This function reads the date of the last check from the
|
||||
\"last-package-upgrade\" file. Where this file is looked for is
|
||||
guessed as follows:
|
||||
|
||||
If `user-emacs-cache-directory' is set (e.g. by the
|
||||
`xdg-paths.el' package available from
|
||||
https://github.com/tomprince/xdg-paths-el), the timestamp file is
|
||||
opened from there. Otherwise, it will be read from
|
||||
`user-emacs-directory'
|
||||
|
||||
If NO-SAVE is 'nil', the current date will be saved to the
|
||||
timestamp file.
|
||||
|
||||
The return value of this function will be 't' if the timestamp
|
||||
file contains todays date, 'nil' otherwise."
|
||||
|
||||
(let ((tsfile-location (if (boundp 'user-emacs-cache-directory)
|
||||
user-emacs-cache-directory
|
||||
user-emacs-directory)))
|
||||
(unless (and (file-exists-p tsfile-location)
|
||||
(file-accessible-directory-p tsfile-location))
|
||||
(make-directory tsfile-location t))
|
||||
|
||||
(let ((timestamp-today t)
|
||||
(timestamp-buffer (find-file-literally
|
||||
(expand-file-name "last-package-upgrade"
|
||||
tsfile-location))))
|
||||
(with-current-buffer timestamp-buffer
|
||||
(goto-char 0)
|
||||
(unless (looking-at-p (format-time-string "%Y-%m-%d"))
|
||||
(unless no-save
|
||||
(erase-buffer)
|
||||
(insert (format-time-string "%Y-%m-%d"))
|
||||
(save-buffer 0))
|
||||
(setq timestamp-today nil))
|
||||
(kill-buffer)
|
||||
timestamp-today))))
|
||||
|
||||
(defun check-for-package-upgrades-on-day (&optional day-number)
|
||||
"Check for package upgrades if today is DAY-NUMBER.
|
||||
|
||||
DAY-NUMBER can be anything between 0 and 7, inclusive. Both 0
|
||||
and 7 denote Sunday to make both types of users happy.
|
||||
|
||||
If DAY-NUMBER is 'nil', it defaults to today's day."
|
||||
|
||||
(let ((actual-day-number (cond
|
||||
((eq day-number nil) (string-to-number (format-time-string "%u")))
|
||||
((eq day-number 0) 7)
|
||||
(t day-number))))
|
||||
(when (and (eq day-number (string-to-number (format-time-string "%u")))
|
||||
(not (check-todays-package-upgrade-p t)))
|
||||
(message "Calling")
|
||||
(when (call-interactively 'package-upgrade-all)
|
||||
(message "Called")
|
||||
(check-todays-package-upgrade-p nil)))))
|
||||
|
||||
(provide 'package-manip)
|
||||
|
||||
;;; package-manip.el ends here
|
19
lisp/round-number-to-decimals.el
Normal file
19
lisp/round-number-to-decimals.el
Normal file
@ -0,0 +1,19 @@
|
||||
(defun get-number-at-point ()
|
||||
(interactive)
|
||||
(skip-chars-backward "0123456789.-")
|
||||
(or (looking-at "[0123456789.-]+")
|
||||
(error "No number at point"))
|
||||
(string-to-number (match-string 0)))
|
||||
|
||||
(defun round-number-at-point-to-decimals (decimal-count)
|
||||
(interactive "NDecimal count: ")
|
||||
(let ((mult (expt 10 decimal-count)))
|
||||
(replace-match (number-to-string
|
||||
(/
|
||||
(fround
|
||||
(*
|
||||
mult
|
||||
(get-number-at-point)))
|
||||
mult)))))
|
||||
|
||||
(global-set-key (kbd "C-c r") 'round-number-at-point-to-decimals)
|
7
lisp/text-manip.el
Normal file
7
lisp/text-manip.el
Normal file
@ -0,0 +1,7 @@
|
||||
(defun org-space-key (&optional arg)
|
||||
"Insert two spaces after a period."
|
||||
(interactive "p")
|
||||
|
||||
(when (looking-back "[.!?…]")
|
||||
(call-interactively 'self-insert-command arg))
|
||||
(call-interactively 'self-insert-command arg))
|
56
lisp/window-manip.el
Normal file
56
lisp/window-manip.el
Normal file
@ -0,0 +1,56 @@
|
||||
(defun transpose-windows (arg)
|
||||
"Transpose the buffers shown in two windows."
|
||||
(interactive "p")
|
||||
(let ((selector (if (>= arg 0) 'next-window 'previous-window)))
|
||||
(while (/= arg 0)
|
||||
(let ((this-win (window-buffer))
|
||||
(next-win (window-buffer (funcall selector))))
|
||||
(set-window-buffer (selected-window) next-win)
|
||||
(set-window-buffer (funcall selector) this-win)
|
||||
(select-window (funcall selector)))
|
||||
(setq arg (if (plusp arg) (1- arg) (1+ arg))))))
|
||||
|
||||
(defun toggle-window-split ()
|
||||
(interactive)
|
||||
(if (= (count-windows) 2)
|
||||
(let* ((this-win-buffer (window-buffer))
|
||||
(next-win-buffer (window-buffer (next-window)))
|
||||
(this-win-edges (window-edges (selected-window)))
|
||||
(next-win-edges (window-edges (next-window)))
|
||||
(this-win-2nd (not (and (<= (car this-win-edges)
|
||||
(car next-win-edges))
|
||||
(<= (cadr this-win-edges)
|
||||
(cadr next-win-edges)))))
|
||||
(splitter
|
||||
(if (= (car this-win-edges)
|
||||
(car (window-edges (next-window))))
|
||||
'split-window-horizontally
|
||||
'split-window-vertically)))
|
||||
(delete-other-windows)
|
||||
(let ((first-win (selected-window)))
|
||||
(funcall splitter)
|
||||
(if this-win-2nd (other-window 1))
|
||||
(set-window-buffer (selected-window) this-win-buffer)
|
||||
(set-window-buffer (next-window) next-win-buffer)
|
||||
(select-window first-win)
|
||||
(if this-win-2nd (other-window 1))))
|
||||
(error "This works only for two windows!")))
|
||||
|
||||
(defun gpolonkai/scroll-window-up (window)
|
||||
"Scroll WINDOW up as `scroll-up-command' would."
|
||||
(interactive)
|
||||
(save-selected-window
|
||||
(select-window window)
|
||||
(scroll-up)))
|
||||
|
||||
(defun gpolonkai/scroll-window-down (window)
|
||||
"Scroll WINDOW down as `scroll-down-command' would."
|
||||
(interactive)
|
||||
(save-selected-window
|
||||
(select-window window)
|
||||
(scroll-down)))
|
||||
|
||||
(defun gpolonkai/bury-window (window)
|
||||
"Quit WINDOW without killing it."
|
||||
(interactive)
|
||||
(quit-window nil window))
|
@ -40,7 +40,7 @@
|
||||
;;; user-documents-directory ~/Documents
|
||||
;;;
|
||||
;;; Some convenience functions are defined to locate files in these
|
||||
;;; directories and to add user Lisp to load-path.
|
||||
;;; directories and to add user lisp to load-path.
|
||||
;;;
|
||||
;;; Some advantages are:
|
||||
;;;
|
||||
@ -114,28 +114,28 @@
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl-lib))
|
||||
(require 'cl))
|
||||
|
||||
;;; Directories definition.
|
||||
(defvar user-emacs-config-directory nil
|
||||
"The directory where the Emacs user configuration files are stored at.")
|
||||
"The directory where the emacs user configuration files are stored at.")
|
||||
|
||||
|
||||
(defvar user-emacs-data-directory nil
|
||||
"The directory where the Emacs user data and Lisp files are stored at.
|
||||
"The directory where the emacs user data and lisp files are stored at.
|
||||
|
||||
\\[user-emacs-directory] is set to this directory.")
|
||||
|
||||
|
||||
(defvar user-emacs-cache-directory nil
|
||||
"The directory where the Emacs user expendable files are stored at.
|
||||
"The directory where the emacs user expendable files are stored at.
|
||||
|
||||
Files stored here should not be missed when deleted, apart a
|
||||
temporary loss in speed.")
|
||||
|
||||
|
||||
(defvar user-emacs-lisp-directory nil
|
||||
"The directory where the user Lisp packages are stored at.
|
||||
"The directory where the user lisp packages are stored at.
|
||||
|
||||
This directory is added to \\[load-path].")
|
||||
|
||||
@ -146,73 +146,72 @@ This directory is added to \\[load-path].")
|
||||
|
||||
|
||||
(defun xdg-user-dir (dirname)
|
||||
"Given DIRNAME, run 'xdg-user-dir DIRNAME' and return the result in a string.
|
||||
"Given NAME, run 'xdg-user-dir NAME' and return the result in a string.
|
||||
|
||||
If the command fails, return NIL."
|
||||
(let ((command (concat "xdg-user-dir " dirname)))
|
||||
(if (zerop (shell-command command))
|
||||
(substring (shell-command-to-string command) 0 -1)
|
||||
(substring (shell-command-to-string command) 0 -1)
|
||||
nil)))
|
||||
|
||||
|
||||
(defun locate-user-file (filename &optional type)
|
||||
"Given a file FILENAME, locate it in the user files.
|
||||
"Given a file, locate it in the user files.
|
||||
|
||||
If TYPE is NIL or 'data, the file will be located in user-emacs-data-directory.
|
||||
|
||||
If `config', it will be located in user-emacs-config-directory.
|
||||
If 'config, it will be located in user-emacs-config-directory.
|
||||
|
||||
If `cache', it will be located in user-emacs-cache-directory.
|
||||
If 'cache, it will be located in user-emacs-cache-directory.
|
||||
|
||||
If `lisp', it will be located in user-emacs-lisp-directory.
|
||||
If 'lisp, it will be located in user-emacs-lisp-directory.
|
||||
|
||||
If `documents', it will be located in user-documents-directory.
|
||||
If 'documents, it will be located in user-documents-directory.
|
||||
|
||||
If the category is wrong, an error will be signaled."
|
||||
If the category is wrong, an error will be signaled.
|
||||
"
|
||||
(expand-file-name filename
|
||||
(cond
|
||||
((or (not type) (eq type 'data)) user-emacs-data-directory)
|
||||
((eq type 'config) user-emacs-config-directory)
|
||||
((eq type 'lisp) user-emacs-lisp-directory)
|
||||
((eq type 'cache) user-emacs-cache-directory)
|
||||
((eq type 'documents) user-documents-directory)
|
||||
(t (error "The category %s is not valid" type)))))
|
||||
(case type
|
||||
((nil data) user-emacs-data-directory)
|
||||
('config user-emacs-config-directory)
|
||||
('lisp user-emacs-lisp-directory)
|
||||
('cache user-emacs-cache-directory)
|
||||
('documents user-documents-directory)
|
||||
(t (error "The category %s is not valid" type)))))
|
||||
|
||||
|
||||
(defun locate-user-config-file (filename)
|
||||
"Given a file FILENAME, locate it in `user-emacs-config-directory`."
|
||||
"Given a file, locate it in `user-emacs-config-directory`."
|
||||
(locate-user-file filename 'config))
|
||||
|
||||
|
||||
(defun locate-user-lisp (filename)
|
||||
"Given a file FILENAME, locate it in `user-emacs-lisp-directory`."
|
||||
"Given a file, locate it in `user-emacs-lisp-directory`."
|
||||
(locate-user-file filename 'lisp))
|
||||
|
||||
|
||||
(defun add-to-path (directory &optional append)
|
||||
"Given DIRECTORY, it it exists and is a directory, add it to `load-path`.
|
||||
|
||||
APPEND is passed verbatim to `add-to-list'."
|
||||
"Given DIRECTORY, it it exists and is indeed a directory, add
|
||||
it to `load-path`."
|
||||
(interactive "D")
|
||||
(if (file-directory-p directory)
|
||||
(add-to-list 'load-path directory append)
|
||||
(error "The directory \"%s\" does not exist or isn't a directory" directory)))
|
||||
(error "The directory \"%s\" does not exist or isn't a directory." directory)))
|
||||
|
||||
|
||||
(defun add-user-lisp-to-path (directory &optional append)
|
||||
"Given DIRECTORY, if it exists and is a directory, add it to `load-path`.
|
||||
|
||||
APPEND is passed directly to `add-to-path'."
|
||||
"Given DIRECTORY, it it exists and is indeed a directory, add
|
||||
it to `load-path`."
|
||||
(interactive "D")
|
||||
(add-to-path (locate-user-lisp directory) append))
|
||||
|
||||
|
||||
;; Set the default variables if they have no name.
|
||||
(cl-macrolet ((setq-if-null (variable value)
|
||||
`(if (null ,variable)
|
||||
(setf ,variable ,value)))
|
||||
(getdir (variable fallback)
|
||||
`(expand-file-name "emacs/" (or (getenv ,variable) ,fallback))))
|
||||
(macrolet ((setq-if-null (variable value)
|
||||
`(if (null ,variable)
|
||||
(setf ,variable ,value)))
|
||||
(getdir (variable fallback)
|
||||
`(expand-file-name "emacs/" (or (getenv ,variable) ,fallback))))
|
||||
(setq-if-null user-emacs-config-directory (getdir "XDG_CONFIG_HOME" "~/.config/"))
|
||||
(setq-if-null user-emacs-data-directory (getdir "XDG_DATA_HOME" "~/.local/share/"))
|
||||
(setq-if-null user-emacs-cache-directory (getdir "XDG_CACHE_HOME" "~/.cache/"))
|
||||
@ -220,10 +219,12 @@ APPEND is passed directly to `add-to-path'."
|
||||
(setq-if-null user-documents-directory (or (xdg-user-dir "DOCUMENTS") "~/Documents")))
|
||||
|
||||
|
||||
;; Set the user-emacs-directory to user-emacs-data-directory.
|
||||
;(setf user-emacs-directory user-emacs-data-directory)
|
||||
|
||||
|
||||
;; Add the user lisp directory to path.
|
||||
(add-to-list 'load-path user-emacs-lisp-directory)
|
||||
|
||||
|
||||
(provide 'xdg-paths)
|
||||
|
||||
;;; xdg-paths.el ends here
|
||||
|
19
lisp/zim.el
Normal file
19
lisp/zim.el
Normal file
@ -0,0 +1,19 @@
|
||||
(defun zim-timestamp ()
|
||||
(with-temp-buffer
|
||||
(insert (format-time-string "%Y-%m-%dT%H:%M:%S%z"))
|
||||
(forward-char -2)
|
||||
(insert ":")
|
||||
(buffer-string)))
|
||||
|
||||
(defun insert-zim-timestamp ()
|
||||
(interactive)
|
||||
(insert (zim-timestamp)))
|
||||
|
||||
(defun insert-zim-header ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(insert
|
||||
(concat "Content-Type: text/x-zim-wiki\n"
|
||||
"Wiki-Format: zim 0.4\n"
|
||||
"Creation-Date: " (zim-timestamp) "\n\n"))))
|
@ -1,11 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: GObject H boilerplate
|
||||
# key: gobh
|
||||
# --
|
||||
# include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
$0
|
||||
|
||||
G_END_DECLS
|
@ -1,10 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Protect with ifdef
|
||||
# key: defprot
|
||||
# --
|
||||
#ifndef ${1:name}
|
||||
# define $1
|
||||
|
||||
$0
|
||||
|
||||
#endif /* $1 */
|
@ -1,19 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: agpl-header
|
||||
# key: agpl
|
||||
# --
|
||||
# ${1:project_name}
|
||||
# Copyright (C) ${2:year} ${3:author_name}
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
@ -1,10 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: flask_sqlalchemy_model
|
||||
# key: model
|
||||
# --
|
||||
class ${1:name}(db.Model):
|
||||
__tablename__ = '${2:tablename}'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
|
||||
$0
|
@ -1,9 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: New unittest
|
||||
# key: testdef
|
||||
# --
|
||||
def test_${1:name}(self):
|
||||
"""${2:docstring}
|
||||
"""
|
||||
|
||||
$0self.assertTrue(False)
|
@ -1,14 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Translatable Flask-SQLAlchemy model
|
||||
# key: tmodel
|
||||
# --
|
||||
class ${1:name}(Translatable, db.Model):
|
||||
__tablename__ = '${2:tablename}s'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
|
||||
|
||||
class $1Translation(translation_base($1)):
|
||||
__tablename__ = '$2_translations'
|
||||
|
||||
$0
|
@ -1,5 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Viewport Meta tag
|
||||
# key: vp
|
||||
# --
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
Loading…
Reference in New Issue
Block a user