Ilya Zakharevich <ilya(a)math.ohio-state.edu> writes:
I had a long email exchange about 4 with some rude person (do not
remember the name). Since he refused to follow CPerl policy (that
XEmacs-specific customizations should be done via macros defined at
the start of the file - if possible), I could not incorporate his
patches.
Would something like this be acceptible? The only changes below the
portability sections are hooks for to call the macro. This is for 4.
only
diff -u /u/users/vroonhof/emacs/lisp/cperl-mode.el.4.5
/u/users/vroonhof/emacs/lisp/cperl-mode.el
--- /u/users/vroonhof/emacs/lisp/cperl-mode.el.4.5 Tue Aug 18 16:50:13 1998
+++ /u/users/vroonhof/emacs/lisp/cperl-mode.el Tue Aug 18 16:50:13 1998
@@ -800,6 +800,10 @@
;;; `constant-face' was backward.
;;; (`font-lock-other-type-face'): Done via `defface' too.
+;;; After 4.5
+;;; (`cperl-set-conformant-backward-deletion'): Follow policy of the
+;;; Emacs version
+
;;; Code:
@@ -847,6 +851,7 @@
(cperl-make-face (, arg) (, descr)))
(or (boundp (quote (, arg))) ; We use unquoted variants too
(defconst (, arg) (quote (, arg)) (, descr))))))))
+
(require 'custom)
(defun cperl-choose-color (&rest list)
@@ -1537,7 +1542,8 @@
;;; Portability stuff:
-(defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version))
+(defconst cperl-xemacs-p (or (featurep 'xemacs)
+ (string-match "XEmacs\\|Lucid" emacs-version)))
(defmacro cperl-define-key (emacs-key definition &optional xemacs-key)
(` (define-key cperl-mode-map
@@ -1551,6 +1557,16 @@
(where-is-internal 'backward-delete-char-untabify)))
"Character generated by key bound to delete-backward-char.")
+(defvar cperl-backward-delete-function nil)
+
+(defmacro cperl-set-conformant-backward-deletion (func)
+ `(if (not (boundp 'backward-delete-function))
+ (cperl-define-key "\177" ,func)
+ ;; we do not clobber backspace on standard Emacs, why?
+ (setq cperl-backward-delete-function ,func)
+ (define-key cperl-mode-map [backspace] ,func)
+ (setq cperl-del-back-ch 'backspace)))
+
(and (vectorp cperl-del-back-ch) (= (length cperl-del-back-ch) 1)
(setq cperl-del-back-ch (aref cperl-del-back-ch 0)))
@@ -1681,7 +1697,7 @@
[(control meta |)])
;;(cperl-define-key "\M-q" 'cperl-fill-paragraph)
;;(cperl-define-key "\e;" 'cperl-indent-for-comment)
- (cperl-define-key "\177" 'cperl-electric-backspace)
+ (cperl-set-conformant-backward-deletion 'cperl-electric-backspace)
(cperl-define-key "\t" 'cperl-indent-command)
;; don't clobber the backspace binding:
(cperl-define-key "\C-c\C-hF" 'cperl-info-on-command
@@ -2126,6 +2142,9 @@
(make-local-variable 'vc-header-alist)
(set 'vc-header-alist cperl-vc-header-alist) ; Avoid warning
(make-local-variable 'font-lock-defaults)
+ (when cperl-backward-delete-function
+ (make-local-variable 'backward-delete-function)
+ (setq backward-delete-function cperl-backward-delete-function))
(setq font-lock-defaults
(cond
((string< emacs-version "19.30")