Loading ...
Sorry, an error occurred while loading the content.
 

perldoc with searchitem popup-toc

Expand Messages
  • dgroth@gmx.de
    hello, Improvement of the perldoc command. Starting a working session you can grab all the neccessary information via perldoc s in the *pod*-buffer, with some
    Message 1 of 1 , Aug 10, 2001
      hello,

      Improvement of the perldoc command.
      Starting a working session you can grab all the neccessary information
      via perldoc's in the *pod*-buffer, with some hilighting and with a popup
      (<f7> or <C-S-mouse-pick-1> in this example) for fast refinding of our
      search items. This feature could be readjusted easily let's say for manpages
      and similar stuff.

      The menu is generated on the fly, but not nested. Regarding the nested
      ordered buffer popup I provided recently we will go next.

      have a nice weekend,
      detlef

      ; user.emf
      add-file-hook "*pod*" fhook-pod
      define-macro-file perldoc

      ; hkpod.emf
      ; Detlef Groth : Thursday, 9 August 2001

      !if &seq .hilight.mode "ERROR"
      set-variable .hilight.pod &pinc .hilight.next 1
      !endif
      ;
      ; Define the hilighting
      ;
      0 hilight .hilight.pod 1 $global-scheme
      hilight .hilight.pod 2 "#" .scheme.comment
      hilight .hilight.pod 4 "\"" "\"" "\\" .scheme.string
      hilight .hilight.pod 0 "'.+'" .scheme.quote

      hilight .hilight.pod 1 "^NAME" .scheme.header
      hilight .hilight.pod 1 "^SYNOPSIS" .scheme.header
      hilight .hilight.pod 1 "^ABSTRACT" .scheme.header
      hilight .hilight.pod 1 "^DESCRIPTION" .scheme.header
      hilight .hilight.pod 1 "^SEE ALSO" .scheme.header
      hilight .hilight.pod 1 "^BUGS" .scheme.header
      hilight .hilight.pod 1 "[a-zA-Z]+::[a-zA-Z]+" .scheme.link

      define-macro fhook-pod
      set-variable $buffer-hilight .hilight.pod
      1 buffer-mode "view"
      !emacro

      ; end hkpod.emf

      ; perldoc.emf
      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      ;
      ; Author : Detlef Groth
      ; Created By : Detlef Groth
      ; Created : Thu Aug 9 15:27:43 2001
      ; Last Modified : <010810.1351>
      ;
      ; Description : Graps the output from perldoc in a special
      ; *pod* buffer providing <f7>/<C-S-mouse-pick-1>
      ; for a toc-popup on perldoc queries
      ;
      ; Notes : perldoc must be in the path in order to get this
      ; working, rerquires *pod* for some hilighting
      ;
      ; History : 09 August 2001 first release
      ;
      ; Copyright (c) 2001 <unknown>.
      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      define-macro perldoc
      ; if perldoc is in the path
      ; graps its output and collects it in the
      ; buffer *pod*
      set-variable .perldoc-command @ml "perldoc"

      ipipe-shell-command &cat "perldoc " .perldoc-command
      perldoc-execute .perldoc-command
      !emacro


      define-macro perldoc-on-package
      ; shows info on a marked package or symbol
      set-variable #l0 @y
      ipipe-shell-command &cat "perldoc " #l0
      perldoc-execute #l0
      !emacro

      define-macro perldoc-on-function
      ; shows info on a marked function
      set-variable #l0 @y
      ipipe-shell-command &cat "perldoc -f " #l0
      perldoc-execute #l0
      !emacro


      0 define-macro perldoc-execute
      !if &sequal $buffer-fhook "fhook-perl"
      next-window-find-buffer "*icommand*"
      !else
      find-buffer "*icommand*"
      !endif
      ; waiting for perldoc finishing
      ; otherwise we will grab nothing :(
      1000 ml-write "waiting for perldoc ...."
      1000 ml-write "waiting for perldoc ....."
      1000 ml-write "waiting for perldoc ......"
      1000 ml-write "waiting for perldoc ......."
      beginning-of-buffer
      search-forward "perldoc"
      forward-line
      set-mark
      end-of-buffer
      exchange-point-and-mark
      copy-region
      find-buffer "*pod*"
      ; now let's build the menu
      -38 buffer-mode "view"
      end-of-buffer
      perldoc-osd-add-menuitem .osd.perldoc @1
      insert-newline
      set-alpha-mark "p"
      yank
      -1 yank
      goto-alpha-mark "p"
      38 buffer-mode "view"
      !emacro

      0 define-macro perldoc-osd-add-menuitem
      ; this builds the menu on the fly
      !if ¬ &exi :lokal
      ; oops a new *pod*-buffer
      ; then we have to start with a new menu
      set-variable :lokal @1
      set-variable :lokal &pinc .osd.next 1
      ; to get the popup easily
      buffer-bind-key perldoc-show-osd "C-S-mouse-pick-1"
      buffer-bind-key perldoc-show-osd "f7"
      osd :lokal 0 "b"
      !endif
      ; now write a menuitem and allow to get line-number later
      osd :lokal &pinc .osd.next 1 "" &cat &cat &cat &cat "|" @2 "|"
      $window-line "|" f perldoc-osd-goto-line
      !emacro
      0 define-macro perldoc-show-osd
      ; shows the osd near the curser
      :lokal osd 0 "ba" &add $cursor-x 1 &sub $cursor-y 1
      !emacro
      0 define-macro perldoc-osd-goto-line
      ; fetch the line number and goto
      goto-line &lget $result 2
      !emacro
      ; end perldoc.emf

      --
      Dr.Detlef Groth
      Neue Scheune 5
      14548 Ferch
      Germany

      Aufgepasst - jetzt viele 1&1 New WebHosting Pakete ohne
      Einrichtungsgebuehr + 1 Monat Grundgebuehrbefreiung!
      http://puretec.de/index.html?ac=OM.PU.PU003K00736T0492a
    Your message has been successfully submitted and would be delivered to recipients shortly.