现在的位置: 首页 > 综合 > 正文

possible code snippets

2017年12月28日 ⁄ 综合 ⁄ 共 793字 ⁄ 字号 评论关闭

;;emacs date and time (November 30,2011 16:18)

;;insert-current-data and time
(defun insert-current-date()
"Insert the current date & time"
(interactive "*")
;(insert (format-time-string "%Y-%m-%d %H:%M:%S" (current-time))))
(insert (format-time-string "%Y-%m-%d %H:%M:%S" (current-time))))
(global-set-key "\C-xj" 'insert-current-date)


(defun qiang-comment-dwim-line (&optional arg)
"Replacement for the comment-dwim command.
If no region is selected and current line is not blank and we are not at the end of the line,
then comment current line.
Replaces default behaviour of comment-dwim, when it inserts comment at the end of the line."
(interactive "*P")
(comment-normalize-vars)
(if (and (not (region-active-p)) (not (looking-at "[ \t]*$")))
(comment-or-uncomment-region (line-beginning-position) (line-end-position))
(comment-dwim arg)))
(global-set-key "\M-;" 'qiang-comment-dwim-line)

【上篇】
【下篇】

抱歉!评论已关闭.