Thank you for your comments Juri. Do you have a thought on how to implement this functionality as a package the way Stefan asked for? Negative arguments in particular seem to be challenging. Right now I implemented negative argument navigation by calling isearch-repeat with the opposite functionality but that has all kinds of odd effects. For example the search message changes, C-- C-1 isearch-forward does not go back one matched string but rather just switches to isearch-backward and so on. I did implement visual hints for the negative arguments because that would require changing the way lazy highlight works significantly (lazy-highlight loop wraps around back to the first line and at that point you can't know the negative argument for the current match). On Fri, Jan 27, 2012 at 3:44 AM, Juri Linkov wrote: > > Please try it out. > > Thanks. A few comments below: > > > + ;; Bring universal-argument and friends back in > > + (define-key map "\C-u" 'universal-argument) > > + (define-key map (kbd "C--") 'negative-argument) > > + (define-key map (kbd "C-0") 'digit-argument) > > + (define-key map (kbd "C-1") 'digit-argument) > > + (define-key map (kbd "C-2") 'digit-argument) > > + (define-key map (kbd "C-3") 'digit-argument) > > + (define-key map (kbd "C-4") 'digit-argument) > > + (define-key map (kbd "C-5") 'digit-argument) > > + (define-key map (kbd "C-6") 'digit-argument) > > + (define-key map (kbd "C-7") 'digit-argument) > > + (define-key map (kbd "C-8") 'digit-argument) > > + (define-key map (kbd "C-9") 'digit-argument) > > > + (define-key meta-map (kbd "-") 'negative-argument) > > + (define-key meta-map (kbd "C--") 'negative-argument) > > + (define-key meta-map (kbd "C-0") 'digit-argument) > > + (define-key meta-map (kbd "C-1") 'digit-argument) > > + (define-key meta-map (kbd "C-2") 'digit-argument) > > + (define-key meta-map (kbd "C-3") 'digit-argument) > > + (define-key meta-map (kbd "C-4") 'digit-argument) > > + (define-key meta-map (kbd "C-5") 'digit-argument) > > + (define-key meta-map (kbd "C-6") 'digit-argument) > > + (define-key meta-map (kbd "C-7") 'digit-argument) > > + (define-key meta-map (kbd "C-8") 'digit-argument) > > + (define-key meta-map (kbd "C-9") 'digit-argument)) > > Instead of adding these keybindings, you can just set > `isearch-allow-scroll' to t. > > Also there are plans to add a better variable `isearch-enable-prefix' > in 24.2, you can see more information at this link - > http://thread.gmane.org/gmane.emacs.devel/143829 > > > -(defun isearch-repeat-forward () > > +(defun isearch-repeat-forward (arg) > > > -(defun isearch-repeat-backward () > > +(defun isearch-repeat-backward (arg) > > Please use (&optional arg) for backward-compatibility. > > > + (setq hint (number-to-string count)) > > + (setq count (1+ count)) > > + (set-text-properties 0 (length hint) > '(face lazy-highlight-hint) hint) > > + (overlay-put ov 'before-string hint))) > > A suggestion by Tassilo to use superscripts looks good too, > but then these hints look like references to footnotes :-) >