unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* zap-to-char to more sensitiveness?
@ 2006-09-05 15:10 Michaël Cadilhac
  2006-09-06 19:05 ` Richard Stallman
  0 siblings, 1 reply; 2+ messages in thread
From: Michaël Cadilhac @ 2006-09-05 15:10 UTC (permalink / raw)



[-- Attachment #1.1.1: Type: text/plain, Size: 148 bytes --]


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?


[-- Attachment #1.1.2: simple.patch --]
[-- Type: text/x-patch, Size: 2178 bytes --]

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  <michael.cadilhac@lrde.org>
+ 
+ 	* simple.el (zap-to-char): Be case sensitive if the character to zap to
+ 	is uppercase.
+ 

[-- Attachment #1.1.3: Type: text/plain, Size: 382 bytes --]


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: micha@amessage.be --'                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-06 19:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-05 15:10 zap-to-char to more sensitiveness? Michaël Cadilhac
2006-09-06 19:05 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).