def _make_buffer(self, name, contents, empty_goto=True, switch=False, window='other', modes=[], fit_lines=None): """Make an emacs buffer `window` can be one of `None`, 'current' or 'other'. """ new_buffer = lisp.get_buffer_create(name) lisp.set_buffer(new_buffer) lisp.toggle_read_only(-1) lisp.erase_buffer() if contents or empty_goto: lisp.insert(contents) for mode in modes: lisp[mode + '-mode']() lisp.buffer_disable_undo(new_buffer) lisp.toggle_read_only(1) if switch: if window == 'current': lisp.switch_to_buffer(new_buffer) else: lisp.switch_to_buffer_other_window(new_buffer) lisp.goto_char(lisp.point_min()) elif window == 'other': new_window = lisp.display_buffer(new_buffer) lisp.set_window_point(new_window, lisp.point_min()) if fit_lines and lisp.fboundp(lisp['fit-window-to-buffer']): lisp.fit_window_to_buffer(new_window, fit_lines) lisp.bury_buffer(new_buffer) return new_buffer
def ask_directory(prompt, default=None, starting=None): if default is not None: prompt = prompt + ('[%s] ' % default) if lisp.fboundp(lisp['read-directory-name']): result = lisp.read_directory_name(prompt, starting, default) else: result = lisp.read_file_name(prompt, starting, default) if result == '' and default is not None: return default return result
def ask_directory(self, prompt, default=None, starting=None): location = starting or default if location is not None: prompt = prompt + ('[%s] ' % location) if lisp.fboundp(lisp['read-directory-name']): # returns default when starting is entered result = lisp.read_directory_name(prompt, location, location) else: result = lisp.read_file_name(prompt, location, location) if result == '' and location is not None: return location return result
def create_progress(self, name): if lisp.fboundp(lisp['make-progress-reporter']): progress = _LispProgress(name) else: progress = _OldProgress(name) return progress