This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun davazp/magit-cleanup-hunk-whitespace () | |
"Cleanup the whitespaces in the diff hunk under the cursor." | |
(interactive) | |
(let ((current (magit-current-section))) | |
(when (eq 'hunk (magit-section-type current)) | |
(let ((file (magit-file-at-point)) | |
(context (caddr (magit-section-value current)))) | |
(cl-destructuring-bind (first-line count) | |
(mapcar #'string-to-number (split-string context ",")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; sql-autoupcase.el --- Minor mode for upcasing SQL keywords -*- lexical-binding: t; -*- | |
;; Copyright (C) 2015 David Vazquez | |
;; Author: David Vazquez <[email protected]> | |
;; Keywords: abbrev, convenience, languages | |
;; 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Try to find the string at point as a NodeJS module | |
(require 'ffap) | |
(defun ffap-nodejs-module (name) | |
(unless (or (string-prefix-p "/" name) | |
(string-prefix-p "./" name) | |
(string-prefix-p "../" name)) | |
(let ((base (locate-dominating-file | |
default-directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun switch-to-other-buffer () | |
"Switch to the most recently visited buffer. Calling this | |
command repeatly will switch between the last two most recent | |
buffers." | |
(interactive) | |
(switch-to-buffer (other-buffer))) | |
(define-key global-map (kbd "C-;") 'switch-to-other-buffer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* KBDUS means US Keyboard Layout. This is a scancode table | |
* used to layout a standard US keyboard. I have left some | |
* comments in to give you an idea of what key is what, even | |
* though I set it's array index to 0. You can change that to | |
* whatever you want using a macro, if you wish! */ | |
unsigned char kbdus[128] = | |
{ | |
0, 27, '1', '2', '3', '4', '5', '6', '7', '8', /* 9 */ | |
'9', '0', '-', '=', '\b', /* Backspace */ | |
'\t', /* Tab */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(destructuring-bind ((var count &optional result) &body body) | |
list | |
nil) | |
;; => | |
(LET* ((#:G19046 (VALIDATE-REQVARS LIST 1)) | |
(#:G19047 (VALIDATE-REQVARS (CAR #:G19046) 2)) | |
(VAR (CAR #:G19047)) | |
(COUNT (CAR (CDR #:G19047))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun erc-emphatize () | |
(when (eq erc-interpret-controls-p t) | |
(goto-char (point-min)) | |
(while (re-search-forward "\\(?:^\\|\\s-\\)\\*\\([^*]+\\)\\*\\(:?$\\|\\s-\\)" nil t) | |
(replace-match "\C-b\\1\C-o" nil nil)) | |
(goto-char (point-min)) | |
(while (re-search-forward "\\(?:^\\|\\s-\\)_\\([^_]+\\)_\\(?:$\\|\\s-\\)" nil t) | |
(replace-match "\C-_\\1\C-O" nil nil)) | |
(goto-char (point-min)) | |
(while (re-search-forward "\\(?:^\\|\\s-\\)/\\([^/]+\\)/\\(?:$\\|\\s-\\)" nil t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; URL handlers for Gists | |
(defvar gist-directory | |
"~/.gists/") | |
(defvar gist-url-regex | |
"^https://gist.github.com/\\(.*\\)$") | |
(defun gist-retrieve (id) | |
(unless (file-exists-p gist-directory) |
NewerOlder