Skip to Content.
Sympa Menu

sm-sorcery - [SM-Sorcery]patch for edit_file() & where do patches go?

sm-sorcery AT lists.ibiblio.org

Subject: Discussion of Sorcery related topics

List archive

Chronological Thread  
  • From: Peter Schneider-Kamp <peter AT schneider-kamp.de>
  • To: sm-sorcery <sm-sorcery AT lists.ibiblio.org>
  • Subject: [SM-Sorcery]patch for edit_file() & where do patches go?
  • Date: Sat, 31 Aug 2002 14:28:02 +0200

Should I put patches on bugs.sourcemage.org, send them
to this mailing list or somewhere else?

The attached patch uses an extended approach to getting
the right editor (similar to the one used for $OPTS in cast).

Questions about the patch:
1) May edit_file() change the content of $EDITOR?
2) Should one rely on `which nano` working?
--
Peter Schneider-Kamp mailto:peter AT schneider-kamp.de
Deliusstrasse 9 http://schneider-kamp.de
D-52064 Aachen mobile phone: ++49 178 495 1040
? usr/sbin/cast.ideas
Index: usr/sbin/cast
===================================================================
RCS file: /cvsroot/sourcemage/sourcemage/sorcery/usr/sbin/cast,v
retrieving revision 1.23
diff -c -r1.23 cast
*** usr/sbin/cast 2002/08/26 01:57:32 1.23
--- usr/sbin/cast 2002/08/31 12:14:43
***************
*** 235,259 ****
cat /var/cache/config/$SPELL
fi
if query "Do you wish to add -- options to ./configure?" n ;
then
! if [[ $EDITOR ]]; then
! if [[ $EDITOR == /usr/bin/emacs ]] || \
! [[ $EDITOR == /usr/bin/vi ]] || \
! [[ $EDITOR == /usr/bin/jed ]] || \
! [[ $EDITOR == /usr/bin/ed ]] || \
! [[ $EDITOR == /usr/bin/vim ]] || \
! [[ $EDITOR == /usr/bin/nano ]] ; then
! if [ ! -x $EDITOR ]; then
! EDITOR=/usr/bin/nano
! fi
! else
! EDITOR=/usr/bin/nano
! fi
! else
! EDITOR=/usr/bin/nano
! fi
! $EDITOR /var/cache/config/$SPELL
! OPTS="$OPTS `cat /var/cache/config/$SPELL`"
! message "${MESSAGE_COLOR} OPTS= ${SPELL_COLOR}$OPTS"
fi
fi
fi
--- 235,243 ----
cat /var/cache/config/$SPELL
fi
if query "Do you wish to add -- options to ./configure?" n ;
then
! edit_file /var/cache/config/$SPELL
! OPTS="$OPTS `cat /var/cache/config/$SPELL`"
! message "${MESSAGE_COLOR} OPTS= ${SPELL_COLOR}$OPTS"
fi
fi
fi
Index: var/lib/sorcery/modules/libmisc
===================================================================
RCS file:
/cvsroot/sourcemage/sourcemage/sorcery/var/lib/sorcery/modules/libmisc,v
retrieving revision 1.12
diff -c -r1.12 libmisc
*** var/lib/sorcery/modules/libmisc 2002/08/25 02:28:16 1.12
--- var/lib/sorcery/modules/libmisc 2002/08/31 12:14:44
***************
*** 268,281 ****
#---------------------------------------------------------------------
##=item edit_file <filename>
##
! ## Runs the editor given by C<EDITOR> (or nano if C<EDITOR> is not set)
! ## on the file given in the first argument.
##
#---------------------------------------------------------------------
edit_file() {

! ${EDITOR:-nano} $1
!
}


--- 268,296 ----
#---------------------------------------------------------------------
##=item edit_file <filename>
##
! ## Runs the editor given by C<EDITOR> on the file given in the first
! ## argument if C<EDITOR> is set and points to one of the following
! ## editors: emacs, vi, jed, ed, vim.
! ## Otherwise nano is used.
##
#---------------------------------------------------------------------
edit_file() {

! SEDITOR=`which ${EDITOR:-nano}`
! if [[ $SEDITOR == /usr/bin/emacs ]] || \
! [[ $SEDITOR == /usr/bin/vi ]] || \
! [[ $SEDITOR == /usr/bin/jed ]] || \
! [[ $SEDITOR == /usr/bin/ed ]] || \
! [[ $SEDITOR == /usr/bin/vim ]] ; then
! if [ ! -x $SEDITOR ]; then
! SEDITOR=`which nano`
! fi
! else
! SEDITOR=`which nano`
! fi
! [[ $DEBUG ]] && echo "Editing $1 with $SEDITOR" >> $DEBUG
! ${SEDITOR} $1
!
}




  • [SM-Sorcery]patch for edit_file() & where do patches go?, Peter Schneider-Kamp, 08/31/2002

Archive powered by MHonArc 2.6.24.

Top of Page