update packages
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
-*- coding: utf-8 -*-
|
||||
Originally started by Xah Lee (xahlee.org) on 2009-02-22
|
||||
Released under GPL 3.
|
||||
|
||||
Feel free to add missing ones or modify existing ones to improve.
|
||||
|
||||
Those starting with “x-” are supposed to be idiom templates. Not sure it's very useful. They might start with “i-” or "id-" in the future.
|
||||
@@ -4,4 +4,4 @@
|
||||
# key: delete-directory
|
||||
# key: dd
|
||||
# --
|
||||
(delete-directory ${1:dicretory}${2: recursive})
|
||||
(delete-directory ${1:directory}${2: recursive})
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: find and replace on region
|
||||
# contributor : Xah Lee
|
||||
# --
|
||||
(defun replace-html-chars-region (start end)
|
||||
"Replace “<” to “<” and other chars in HTML.
|
||||
This works on the current region."
|
||||
(interactive "r")
|
||||
(save-restriction
|
||||
(narrow-to-region start end)
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "&" nil t) (replace-match "&" nil t))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "<" nil t) (replace-match "<" nil t))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward ">" nil t) (replace-match ">" nil t))
|
||||
)
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: grab word under cursor
|
||||
# key: grabthing
|
||||
# contributor : Xah Lee
|
||||
# --
|
||||
(setq $0 (thing-at-point 'symbol))
|
||||
@@ -15,18 +15,18 @@
|
||||
${9:
|
||||
;; This file is not part of GNU Emacs
|
||||
|
||||
;; This file is free software; you can redistribute it and/or modify
|
||||
;; 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, or (at your option)
|
||||
;; any later version.
|
||||
;; 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/>.
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: traversing a directory
|
||||
# contributor : Xah Lee
|
||||
# --
|
||||
;; apply a function to all files in a dir
|
||||
(require 'find-lisp)
|
||||
(mapc 'my-process-file (find-lisp-find-files "~/myweb/" "\\.html$"))
|
||||
@@ -1,18 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: process marked files in dired
|
||||
# key: x-dired
|
||||
# --
|
||||
;; idiom for processing a list of files in dired's marked files
|
||||
|
||||
;; suppose myProcessFile is your function that takes a file path
|
||||
;; and do some processing on the file
|
||||
|
||||
(defun dired-myProcessFile ()
|
||||
"apply myProcessFile function to marked files in dired."
|
||||
(interactive)
|
||||
(require 'dired)
|
||||
(mapc 'myProcessFile (dired-get-marked-files))
|
||||
)
|
||||
|
||||
;; to use it, type M-x dired-myProcessFile
|
||||
@@ -1,19 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: a function that process a file
|
||||
# key: x-file
|
||||
# --
|
||||
(defun doThisFile (fpath)
|
||||
"Process the file at path FPATH ..."
|
||||
(let ()
|
||||
;; create temp buffer without undo record or font lock. (more efficient)
|
||||
;; first space in temp buff name is necessary
|
||||
(set-buffer (get-buffer-create " myTemp"))
|
||||
(insert-file-contents fpath nil nil nil t)
|
||||
|
||||
;; process it ...
|
||||
;; (goto-char 0) ; move to begining of file's content (in case it was open)
|
||||
;; ... do something here
|
||||
;; (write-file fpath) ;; write back to the file
|
||||
|
||||
(kill-buffer " myTemp")))
|
||||
@@ -1,19 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: read lines of a file
|
||||
# key: x-file
|
||||
# --
|
||||
(defun read-lines (filePath)
|
||||
"Return a list of lines in FILEPATH."
|
||||
(with-temp-buffer
|
||||
(insert-file-contents filePath)
|
||||
(split-string
|
||||
(buffer-string) "\n" t)))
|
||||
|
||||
;; process all lines
|
||||
(mapc
|
||||
(lambda (aLine)
|
||||
(message aLine) ; do your stuff here
|
||||
)
|
||||
(read-lines "inputFilePath")
|
||||
)
|
||||
@@ -1,19 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: find and replace on region
|
||||
# key: x-find-replace
|
||||
# --
|
||||
(defun replace-html-chars-region (start end)
|
||||
"Replace “<” to “<” and other chars in HTML.
|
||||
This works on the current region."
|
||||
(interactive "r")
|
||||
(save-restriction
|
||||
(narrow-to-region start end)
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "&" nil t) (replace-match "&" nil t))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "<" nil t) (replace-match "<" nil t))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward ">" nil t) (replace-match ">" nil t))
|
||||
)
|
||||
)
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: grab buffer substring
|
||||
# key: x-grabstring
|
||||
# --
|
||||
(setq $0 (buffer-substring-no-properties myStartPos myEndPos))
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: grab word under cursor
|
||||
# key: x-grabthing
|
||||
# --
|
||||
(setq $0 (thing-at-point 'symbol))
|
||||
@@ -1,8 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: traversing a directory
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# key: x-traverse_dir
|
||||
# --
|
||||
;; apply a function to all files in a dir
|
||||
(require 'find-lisp)
|
||||
(mapc 'my-process-file (find-lisp-find-files "~/myweb/" "\\.html$"))
|
||||
@@ -1,29 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: Command that works on region or word
|
||||
# key: x-word-or-region
|
||||
# --
|
||||
;; example of a command that works on current word or text selection
|
||||
(defun down-case-word-or-region ()
|
||||
"Lower case the current word or text selection."
|
||||
(interactive)
|
||||
(let (pos1 pos2 meat)
|
||||
(if (and transient-mark-mode mark-active)
|
||||
(setq pos1 (region-beginning)
|
||||
pos2 (region-end))
|
||||
(setq pos1 (car (bounds-of-thing-at-point 'symbol))
|
||||
pos2 (cdr (bounds-of-thing-at-point 'symbol))))
|
||||
|
||||
; now, pos1 and pos2 are the starting and ending positions
|
||||
; of the current word, or current text selection if exists
|
||||
|
||||
;; put your code here.
|
||||
$0
|
||||
;; Some example of things you might want to do
|
||||
(downcase-region pos1 pos2) ; example of a func that takes region as args
|
||||
(setq meat (buffer-substring-no-properties pos1 pos2)) ; grab the text.
|
||||
(delete-region pos1 pos2) ; get rid of it
|
||||
(insert "newText") ; insert your new text
|
||||
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user