diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2019-09-05 14:00:25 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2019-09-05 16:46:12 +0200 |
| commit | 99f78178964d12e3a8ae6cc4aebf894320e562df (patch) | |
| tree | 1c780d0b9d4740a41616ae716decbc469a102d8d /.emacs.d/lisp | |
| parent | 0f3444ced75558884334a99fc04b9c72b1924e42 (diff) | |
| download | dotfiles-99f78178964d12e3a8ae6cc4aebf894320e562df.tar.gz dotfiles-99f78178964d12e3a8ae6cc4aebf894320e562df.zip | |
Added linters and polished code
The minimum version supported has been raised to 25.3.
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to '.emacs.d/lisp')
| -rw-r--r-- | .emacs.d/lisp/g.el | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/.emacs.d/lisp/g.el b/.emacs.d/lisp/g.el index 3a4660a..fe842d8 100644 --- a/.emacs.d/lisp/g.el +++ b/.emacs.d/lisp/g.el @@ -1,7 +1,15 @@ -;;; g.el --- Adding shortcuts to GNU Emacs - +;;; g.el --- Adding shortcuts -*- lexical-binding: t; -*- +;; ;; Copyright (C) 2016-2019 Miquel Sabaté Solà <mikisabate@gmail.com> ;; +;; Author: Miquel Sabaté Solà <mikisabate@gmail.com> +;; Version: 0.1 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: abbrev, convenience +;; URL: https://github.com/mssola/dotfiles/.emacs.d/lisp/g.el +;; +;; This file is not part of GNU Emacs. +;; ;; 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 @@ -14,11 +22,7 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <http://www.gnu.org/licenses/>. - -;; Author: Miquel Sabaté Solà <mikisabate@gmail.com> -;; Version: 0.1 -;; URL: https://github.com/mssola/dotfiles/emacs/site-lisp/g.el - +;; ;;; Commentary: ;; ;; This is a GNU Emacs port of my g.sh bash script that can be found here: @@ -33,15 +37,15 @@ (defvar g-file "~/.gfile" "The path to the gfile.") -;; Utils +;;; Utils (defun g-read-file (file) "Read the given FILE and return it as a list of lines." (if (file-exists-p file) - (with-temp-buffer - (insert-file-contents file) - (split-string (buffer-string) "\n" t)) + (with-temp-buffer + (insert-file-contents file) + (split-string (buffer-string) "\n" t)) "")) (defun g-write (shortcuts) @@ -61,18 +65,18 @@ The returned object is a hash table." (let ((shortcuts (make-hash-table :test 'equal)) (list (g-read-file g-file))) - ; The format of the file is a bit special because it was meant to be easily - ; parseable by Bash. It consists of pairs of lines, where n is the key, and - ; n+1 is the value. + ;; The format of the file is a bit special because it was meant to be easily + ;; parseable by Bash. It consists of pairs of lines, where n is the key, and + ;; n+1 is the value. (dotimes (i (/ (length list) 2)) (let ((n (* i 2))) (puthash (nth n list) (nth (+ n 1) list) shortcuts))) - shortcuts)) + shortcuts)) -;; Interactive functions +;;; Interactive functions (defun g () "Go to the given directory with the supplied alias." |
