emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

zap-to-char to more sensitiveness?


From: Michaël Cadilhac
Subject: zap-to-char to more sensitiveness?
Date: Tue, 05 Sep 2006 17:10:05 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Isearch has this (good) behavior to be case sensitive if one char of
its input is uppercase.  Couldn't zap-to-char have the same (good)
behavior?

Index: simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.812
diff -c -r1.812 simple.el
*** simple.el   20 Aug 2006 12:16:58 -0000      1.812
--- simple.el   5 Sep 2006 15:06:12 -0000
***************
*** 2809,2823 ****
  
  (defun zap-to-char (arg char)
    "Kill up to and including ARG'th occurrence of CHAR.
! Case is ignored if `case-fold-search' is non-nil in the current buffer.
! Goes backward if ARG is negative; error if CHAR not found."
    (interactive "p\ncZap to char: ")
    (if (char-table-p translation-table-for-input)
        (setq char (or (aref translation-table-for-input char) char)))
!   (kill-region (point) (progn
!                        (search-forward (char-to-string char) nil nil arg)
! ;                      (goto-char (if (> arg 0) (1- (point)) (1+ (point))))
!                        (point))))
  
  ;; kill-line and its subroutines.
  
--- 2809,2825 ----
  
  (defun zap-to-char (arg char)
    "Kill up to and including ARG'th occurrence of CHAR.
! Case is ignored if `case-fold-search' is non-nil in the current buffer and
! CHAR is lowercase.  Goes backward if ARG is negative; error if CHAR not 
found."
    (interactive "p\ncZap to char: ")
    (if (char-table-p translation-table-for-input)
        (setq char (or (aref translation-table-for-input char) char)))
!   (let ((case-fold-search (and case-fold-search
!                              (not (eq char (upcase char))))))
!     (kill-region (point) (progn
!                          (search-forward (char-to-string char) nil nil arg)
! ;                        (goto-char (if (> arg 0) (1- (point)) (1+ (point))))
!                          (point)))))
  
  ;; kill-line and its subroutines.
  
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.9966
diff -c -0 -r1.9966 ChangeLog
*** ChangeLog   27 Aug 2006 07:08:19 -0000      1.9966
--- ChangeLog   5 Sep 2006 15:06:21 -0000
***************
*** 0 ****
--- 1,5 ----
+ 2006-09-05  Michaël Cadilhac  <address@hidden>
+ 
+       * simple.el (zap-to-char): Be case sensitive if the character to zap to
+       is uppercase.
+ 
BTW, why is there a commented line in this code?

TIA

-- 
 |      Michaël `Micha' Cadilhac   |  Would someone please DTRT with this,  |
 |         Epita/LRDE Promo 2007   |        then ACK?                       |
 | http://www.lrde.org/~cadilh_m   |          -- Richard Stallman           |
 `--  -   JID: address@hidden --'                                   -  --'

Attachment: pgpQ8y8efaAox.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]