summaryrefslogtreecommitdiff
path: root/lisp/progmodes/delphi.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/delphi.el')
-rw-r--r--lisp/progmodes/delphi.el129
1 files changed, 53 insertions, 76 deletions
diff --git a/lisp/progmodes/delphi.el b/lisp/progmodes/delphi.el
index 86a157a8d0a..d98bb62c0ba 100644
--- a/lisp/progmodes/delphi.el
+++ b/lisp/progmodes/delphi.el
@@ -66,29 +66,6 @@
(provide 'delphi)
-(eval-and-compile
- ;; Allow execution on pre Emacs 20 versions.
- (or (fboundp 'when)
- (defmacro when (test &rest body)
- `(if ,test (progn ,@body))))
- (or (fboundp 'unless)
- (defmacro unless (test &rest body)
- `(if (not ,test) (progn ,@body))))
- (or (fboundp 'defgroup)
- (defmacro defgroup (group val docs &rest group-attributes)
- `(defvar ,group ,val ,docs)))
- (or (fboundp 'defcustom)
- (defmacro defcustom (val-name val docs &rest custom-attributes)
- `(defvar ,val-name ,val ,docs)))
- (or (fboundp 'cadr)
- (defmacro cadr (list) `(car (cdr ,list))))
- (or (fboundp 'cddr)
- (defmacro cddr (list) `(cdr (cdr ,list))))
- (or (fboundp 'with-current-buffer)
- (defmacro with-current-buffer (buf &rest forms)
- `(save-excursion (set-buffer ,buf) ,@forms)))
- )
-
(defgroup delphi nil
"Major mode for editing Delphi source in Emacs."
:version "21.1"
@@ -1642,7 +1619,7 @@ before the indent, the point is moved to the indent."
(when delphi-newline-always-indents
;; Indent both the (now) previous and current line first.
(save-excursion
- (previous-line 1)
+ (forward-line -1)
(delphi-indent-line))
(delphi-indent-line)))
@@ -1677,21 +1654,21 @@ before the indent, the point is moved to the indent."
(unit-file (downcase unit)))
(catch 'done
;; Search for the file.
- (mapcar #'(lambda (file)
- (let ((path (concat dir "/" file)))
- (if (and (string= unit-file (downcase file))
- (delphi-is-file path))
- (throw 'done path))))
- files)
+ (mapc #'(lambda (file)
+ (let ((path (concat dir "/" file)))
+ (if (and (string= unit-file (downcase file))
+ (delphi-is-file path))
+ (throw 'done path))))
+ files)
;; Not found. Search subdirectories.
(when recurse
- (mapcar #'(lambda (subdir)
- (unless (member subdir '("." ".."))
- (let ((path (delphi-search-directory
- unit (concat dir "/" subdir) recurse)))
- (if path (throw 'done path)))))
- files))
+ (mapc #'(lambda (subdir)
+ (unless (member subdir '("." ".."))
+ (let ((path (delphi-search-directory
+ unit (concat dir "/" subdir) recurse)))
+ (if path (throw 'done path)))))
+ files))
;; Not found.
nil))))
@@ -1721,7 +1698,7 @@ before the indent, the point is moved to the indent."
((stringp delphi-search-path)
(delphi-find-unit-in-directory unit delphi-search-path))
- ((mapcar
+ ((mapc
#'(lambda (dir)
(let ((file (delphi-find-unit-in-directory unit dir)))
(if file (throw 'done file))))
@@ -1888,39 +1865,39 @@ comment block. If not in a // comment, just does a normal newline."
(defvar delphi-debug-mode-map
(let ((kmap (make-sparse-keymap)))
- (mapcar #'(lambda (binding) (define-key kmap (car binding) (cadr binding)))
- '(("n" delphi-debug-goto-next-token)
- ("p" delphi-debug-goto-previous-token)
- ("t" delphi-debug-show-current-token)
- ("T" delphi-debug-tokenize-buffer)
- ("W" delphi-debug-tokenize-window)
- ("g" delphi-debug-goto-point)
- ("s" delphi-debug-show-current-string)
- ("a" delphi-debug-parse-buffer)
- ("w" delphi-debug-parse-window)
- ("f" delphi-debug-fontify-window)
- ("F" delphi-debug-fontify-buffer)
- ("r" delphi-debug-parse-region)
- ("c" delphi-debug-unparse-buffer)
- ("x" delphi-debug-show-is-stable)
- ))
+ (mapc #'(lambda (binding) (define-key kmap (car binding) (cadr binding)))
+ '(("n" delphi-debug-goto-next-token)
+ ("p" delphi-debug-goto-previous-token)
+ ("t" delphi-debug-show-current-token)
+ ("T" delphi-debug-tokenize-buffer)
+ ("W" delphi-debug-tokenize-window)
+ ("g" delphi-debug-goto-point)
+ ("s" delphi-debug-show-current-string)
+ ("a" delphi-debug-parse-buffer)
+ ("w" delphi-debug-parse-window)
+ ("f" delphi-debug-fontify-window)
+ ("F" delphi-debug-fontify-buffer)
+ ("r" delphi-debug-parse-region)
+ ("c" delphi-debug-unparse-buffer)
+ ("x" delphi-debug-show-is-stable)
+ ))
kmap)
"Keystrokes for delphi-mode debug commands.")
(defvar delphi-mode-map
(let ((kmap (make-sparse-keymap)))
- (mapcar #'(lambda (binding) (define-key kmap (car binding) (cadr binding)))
- (list '("\r" delphi-newline)
- '("\t" delphi-tab)
- '("\177" backward-delete-char-untabify)
-;; '("\C-cd" delphi-find-current-def)
-;; '("\C-cx" delphi-find-current-xdef)
-;; '("\C-cb" delphi-find-current-body)
- '("\C-cu" delphi-find-unit)
- '("\M-q" delphi-fill-comment)
- '("\M-j" delphi-new-comment-line)
- ;; Debug bindings:
- (list "\C-c\C-d" delphi-debug-mode-map)))
+ (mapc #'(lambda (binding) (define-key kmap (car binding) (cadr binding)))
+ (list '("\r" delphi-newline)
+ '("\t" delphi-tab)
+ '("\177" backward-delete-char-untabify)
+;; '("\C-cd" delphi-find-current-def)
+;; '("\C-cx" delphi-find-current-xdef)
+;; '("\C-cb" delphi-find-current-body)
+ '("\C-cu" delphi-find-unit)
+ '("\M-q" delphi-fill-comment)
+ '("\M-j" delphi-new-comment-line)
+ ;; Debug bindings:
+ (list "\C-c\C-d" delphi-debug-mode-map)))
kmap)
"Keymap used in Delphi mode.")
@@ -1981,17 +1958,17 @@ no args, if that value is non-nil."
(set-syntax-table delphi-mode-syntax-table)
;; Buffer locals:
- (mapcar #'(lambda (var)
- (let ((var-symb (car var))
- (var-val (cadr var)))
- (make-local-variable var-symb)
- (set var-symb var-val)))
- (list '(indent-line-function delphi-indent-line)
- '(comment-indent-function delphi-indent-line)
- '(case-fold-search t)
- '(delphi-progress-last-reported-point nil)
- '(delphi-ignore-changes nil)
- (list 'font-lock-defaults delphi-font-lock-defaults)))
+ (mapc #'(lambda (var)
+ (let ((var-symb (car var))
+ (var-val (cadr var)))
+ (make-local-variable var-symb)
+ (set var-symb var-val)))
+ (list '(indent-line-function delphi-indent-line)
+ '(comment-indent-function delphi-indent-line)
+ '(case-fold-search t)
+ '(delphi-progress-last-reported-point nil)
+ '(delphi-ignore-changes nil)
+ (list 'font-lock-defaults delphi-font-lock-defaults)))
;; We need to keep track of changes to the buffer to determine if we need
;; to retokenize changed text.