def buffer_open(self, buf):
        """register and focus new :class:`~alot.buffers.Buffer`."""

        # call pre_buffer_open hook
        prehook = settings.get_hook('pre_buffer_open')
        if prehook is not None:
            prehook(ui=self, dbm=self.dbman, buf=buf)

        if self.current_buffer is not None:
            offset = settings.get('bufferclose_focus_offset') * -1
            currentindex = self.buffers.index(self.current_buffer)
            self.buffers.insert(currentindex + offset, buf)
        else:
            self.buffers.append(buf)
        self.buffer_focus(buf)

        # call post_buffer_open hook
        posthook = settings.get_hook('post_buffer_open')
        if posthook is not None:
            posthook(ui=self, dbm=self.dbman, buf=buf)
def buffer_open ( self , buf ) : prehook = settings . get_hook ( 'pre_buffer_open' ) if prehook is not None : prehook ( ui = self , dbm = self . dbman , buf = buf ) if self . current_buffer is not None : offset = settings . get ( 'bufferclose_focus_offset' ) * - 1 currentindex = self . buffers . index ( self . current_buffer ) self . buffers . insert ( currentindex + offset , buf ) else : self . buffers . append ( buf ) self . buffer_focus ( buf ) posthook = settings . get_hook ( 'post_buffer_open' ) if posthook is not None : posthook ( ui = self , dbm = self . dbman , buf = buf )
register and focus new :class:`~alot.buffers.Buffer`.