My favorites | Sign in
dea
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
;;; ahei-misc.el --- Some basic utility function of ahei
;; -*- Emacs-Lisp -*-

;; Time-stamp: <2010-09-11 09:53:02 Saturday by taoshanwen>

;; This file 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.

;; This file 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 GNU Emacs; see the file COPYING. If not,
;; write to the Free Software Foundation, Inc., 51 Franklin
;; Street, Fifth Floor, Boston, MA 02110-1301, USA.


;;; Commentary:
;;

;;; Code:

(when (>= 21 emacs-major-version)
(defalias 'move-beginning-of-line 'beginning-of-line)
(defalias 'move-end-of-line 'end-of-line))

;;;###autoload
(defun am-add-hooks (hooks function &optional append local)
"Call `add-hook' on hook list HOOKS use arguments FUNCTION, APPEND, LOCAL.

HOOKS can be one list or just a hook."
(if (listp hooks)
(mapc
`(lambda (hook)
(add-hook hook ',function append local))
hooks)
(add-hook hooks function append local)))

;;;###autoload
(defun am-intern (&rest strings)
"`intern' use STRINGS."
(intern
(apply
'concat
(mapcar
(lambda (element)
(if (stringp element) element (symbol-name element)))
strings))))

;;;###autoload
(defun am-variable-is-t (symbol)
"Return SYMBOL's value is t or not."
(and (boundp symbol) (symbol-value symbol)))

;;;###autoload
(defmacro am-def-active-fun (symbol &optional fun-name)
"Make definition of function judge variable is active or not."
`(defun ,(if fun-name fun-name symbol) ()
,(concat "`" (symbol-name symbol) "' is t or not.")
(am-variable-is-t ',symbol)))

;;;###autoload
(defun am-forward-word-or-to-word ()
"`forward-word' or `forward-to-word'.
If after excute `forward-to-word', current position
is at next line, then rollback and excute `forward-word'"
(interactive)
(let ((noo (line-number-at-pos)) no)
(save-excursion
(forward-to-word 1)
(setq no (line-number-at-pos)))
(if (> no noo)
(forward-word)
(forward-to-word 1))))

;;;###autoload
(defmacro am-with-temp-mode (mode &rest body)
"Create a temporary buffer with mode MODE, and evaluate BODY there like `progn'.
See also `with-temp-buffer'."
`(with-temp-buffer
(funcall ,mode)
,@body))

;;;###autoload
(defun am-equal-ignore-case (str1 str2)
"STR1 equal ignore case to STR2 or not."
(string= (downcase str1) (downcase str2)))

(provide 'ahei-misc)

;;; ahei-misc.el ends here

Change log

r1297 by ahei on Sep 12, 2010   Diff
Add function am-equal-ignore-case.
Go to: 
Project members, sign in to write a code review

Older revisions

r1273 by ahei on Aug 16, 2010   Diff
Add am-with-temp-mode function.
r1143 by ahei on Apr 25, 2010   Diff
Small change.
r1082 by ahei on Apr 10, 2010   Diff
Make my emacs start more quickly use
eval-after-load technique.
Move some settings of .emacs to misc-
settings.el.
All revisions of this file

File info

Size: 2878 bytes, 95 lines
Powered by Google Project Hosting