⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edt.el

📁 早期freebsd实现
💻 EL
📖 第 1 页 / 共 2 页
字号:
;; Copyright (C) 1986 Free Software Foundation, Inc.;;  It started from public domain code by Mike Clarkson;;  but has been greatly altered.;; This file is part of GNU Emacs.;; GNU Emacs 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 1, or (at your option);; any later version.;; GNU Emacs 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, 675 Mass Ave, Cambridge, MA 02139, USA.(require 'keypad)(defvar edt-last-deleted-lines ""  "Last text deleted by an EDT emulation line-delete command.")(defvar edt-last-deleted-words ""  "Last text deleted by an EDT emulation word-delete command.")(defvar edt-last-deleted-chars ""  "Last text deleted by an EDT emulation character-delete command.")(defun delete-current-line (num)  "Delete one or specified number of lines after point.This includes the newline character at the end of each line.They are saved for the EDT undelete-lines command."  (interactive "p")  (let ((beg (point)))    (forward-line num)    (if (not (eq (preceding-char) ?\n))	(insert "\n"))    (setq edt-last-deleted-lines	  (buffer-substring beg (point)))    (delete-region beg (point))))(defun delete-to-eol (num)  "Delete text up to end of line.With argument, delete up to to Nth line-end past point.They are saved for the EDT undelete-lines command."  (interactive "p")  (let ((beg (point)))    (forward-char 1)    (end-of-line num)    (setq edt-last-deleted-lines	  (buffer-substring beg (point)))    (delete-region beg (point))))(defun delete-current-word (num)  "Delete one or specified number of words after point.They are saved for the EDT undelete-words command."  (interactive "p")  (let ((beg (point)))    (forward-word num)    (setq edt-last-deleted-words	  (buffer-substring beg (point)))    (delete-region beg (point))))(defun delete-previous-word (num)  "Delete one or specified number of words before point.They are saved for the EDT undelete-words command."  (interactive "p")  (let ((beg (point)))    (forward-word (- num))    (setq edt-last-deleted-words	  (buffer-substring (point) beg))    (delete-region beg (point))))(defun delete-current-char (num)  "Delete one or specified number of characters after point.They are saved for the EDT undelete-chars command."  (interactive "p")  (setq edt-last-deleted-chars	(buffer-substring (point) (min (point-max) (+ (point) num))))  (delete-region (point) (min (point-max) (+ (point) num))))(defun delete-previous-char (num)  "Delete one or specified number of characters before point.They are saved for the EDT undelete-chars command."  (interactive "p")  (setq edt-last-deleted-chars	(buffer-substring (max (point-min) (- (point) num)) (point)))  (delete-region (max (point-min) (- (point) num)) (point)))(defun undelete-lines ()  "Yank lines deleted by last EDT line-deletion command."  (interactive)  (insert edt-last-deleted-lines))(defun undelete-words ()  "Yank words deleted by last EDT word-deletion command."  (interactive)  (insert edt-last-deleted-words))(defun undelete-chars ()  "Yank characters deleted by last EDT character-deletion command."  (interactive)  (insert edt-last-deleted-chars))(defun next-end-of-line (num)  "Move to end of line; if at end, move to end of next line.Accepts a prefix argument for the number of lines to move."  (interactive "p")  (forward-char)  (end-of-line num))(defun previous-end-of-line (num)  "Move EOL upward.Accepts a prefix argument for the number of lines to move."  (interactive "p")  (end-of-line (- 1 num)))(defun forward-to-word (num)  "Move to next word-beginning, or to Nth following word-beginning."  (interactive "p")  (forward-word (1+ num))  (forward-word -1))(defun backward-to-word (num)  "Move back to word-end, or to Nth word-end seen."  (interactive "p")  (forward-word (- (1+ num)))  (forward-word 1))(defun backward-line (num)  "Move point to start of previous line.Prefix argument serves as repeat-count."  (interactive "p")  (forward-line (- num)))(defun scroll-window-down (num)  "Scroll the display down a window-full.Accepts a prefix argument for the number of window-fulls to scroll."  (interactive "p")  (scroll-down (- (* (window-height) num) 2)))(defun scroll-window-up (num)  "Scroll the display up a window-full.Accepts a prefix argument for the number of window-fulls to scroll."  (interactive "p")  (scroll-up (- (* (window-height) num) 2)))(defun next-paragraph (num)  "Move to beginning of the next indented paragraph.Accepts a prefix argument for the number of paragraphs."  (interactive "p")  (while (> num 0)    (next-line 1)    (forward-paragraph)    (previous-line 1)    (if (eolp) (next-line 1))    (setq num (1- num))))(defun previous-paragraph (num)  "Move to beginning of previous indented paragraph.Accepts a prefix argument for the number of paragraphs."  (interactive "p")  (while (> num 0)    (backward-paragraph)    (previous-line 1)    (if (eolp) (next-line 1))    (setq num (1- num))))(defun move-to-beginning ()  "Move cursor to the beginning of buffer, but don't set the mark."  (interactive)  (goto-char (point-min)))(defun move-to-end ()  "Move cursor to the end of buffer, but don't set the mark."  (interactive)  (goto-char (point-max)))(defun goto-percent (perc)  "Move point to ARG percentage of the buffer."  (interactive "NGoto-percentage: ")  (if (or (> perc 100) (< perc 0))      (error "Percentage %d out of range 0 < percent < 100" perc)    (goto-char (/ (* (point-max) perc) 100))))(defun update-mode-line ()  "Make sure mode-line in the current buffer reflects all changes."  (set-buffer-modified-p (buffer-modified-p))  (sit-for 0))(defun advance-direction ()  "Set EDT Advance mode so keypad commands move forward."  (interactive)  (setq edt-direction-string " ADVANCE")  (define-key function-keymap "\C-c" 'isearch-forward)  ; PF3  (define-key function-keymap "8" 'scroll-window-up) ; "8"  (define-key function-keymap "7" 'next-paragraph)   ; "7"  (define-key function-keymap "1" 'forward-to-word)  ; "1"  (define-key function-keymap "2" 'next-end-of-line) ; "2"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -