def save_files(self, filenames): ask = self.get('confirm_saving') initial = lisp.current_buffer() for filename in filenames: buffer = lisp.find_buffer_visiting(filename) if buffer: if lisp.buffer_modified_p(buffer): if not ask or lisp.y_or_n_p('Save %s buffer?' % filename): lisp.set_buffer(buffer) lisp.save_buffer() lisp.set_buffer(initial)
def _save_buffers(self, only_current=False): ask = lisp['ropemacs-confirm-saving'].value() initial = lisp.current_buffer() current_buffer = lisp.current_buffer() if only_current: buffers = [current_buffer] else: buffers = lisp.buffer_list() for buffer in buffers: filename = lisp.buffer_file_name(buffer) if filename: if self._is_python_file(filename) and \ lisp.buffer_modified_p(buffer): if not ask or lisp.y_or_n_p('Save %s buffer?' % filename): lisp.set_buffer(buffer) lisp.save_buffer() lisp.set_buffer(initial)