() gentsquash () Mon, 27 May 2013 19:24:54 -0700 (PDT) (defun foo () (ns-narrow-to-region 100 200) (goto-char (point-min)) (dired-jump) ;; This next cmd interacts with the user. (dired-do-query-replace-regexp FROM TO) ;; If the above cmd terminates normally, I'd like these ;; to be executed: (dired-find-file) (ns-widen) ) That's like leaving the house and walking around the block (complaining loudly to annoy the neighbors) to get from the kitchen to the bathroom. If you really must, then try: (ignore-errors (save-excursion (dired-do-query-replace-regexp FROM TO))) which catches the throw out of the stateful query-replace loop and furthermore preserves context such that ‘dired-find-file’ does not complain. That is like remembering to lock the door (to thwart negative neighborly retribution) and bring a key. But i have to wonder... Why do you treat your neighbors so? Is it really their business that your soup is too spicy? -- Thien-Thi Nguyen GPG key: 4C807502