help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: small chunk-of-code and a question.


From: Kevin Rodgers
Subject: Re: small chunk-of-code and a question.
Date: Tue, 27 May 2003 14:45:45 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

[Followup-To: gnu.emacs.help]

Tom Wurgler wrote:

Here is a defun I find useful.  Like `looking-at' except looks just before
point. Use it if you can....
(defun looking-back (regexp)
  "Return t if text before point matches regular expression REGEXP.
This function modifies the match data that `match-beginning',
`match-end' and `match-data' access; save and restore the match
data if you want to preserve them."
  (save-excursion
    (let ((beg (point)))
      (if (re-search-backward regexp nil t)
          (if (= (match-end 0) beg)
              t
            nil)
        nil))))


You can get rid of a lot of those nil's and t's:


 (save-excursion
   (let ((beg (point)))
     (and (re-search-backward regexp nil t)
           (= (match-end 0) beg))))

Then the question:

In GNU emacs 20.-, in shell mode, repeated `comint-previous-input' while at the
prompt cycled back though the history of the commands used in that buffer to
date.  When that list was gone through, it started over.  However, starting with
21+, you cycle through the list once and then start cycling through the user's
~/.history list as well.  How can I set it to use the old behaviour, ie I don't
want to use the ~/.history list?


Try this:


(add-hook 'shell-mode-hook
          (lambda () (setq comint-input-ring-file nil)))


--
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;";>Kevin Rodgers</a>



reply via email to

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