Autoload Fails for Only 1 Function
I have a library of LISP functions that autoloads whenever I launch BricsCAD (still using v21). There are about 500 functions, and most are setup to load via the familiar arrangement:
(defun c:myfunc () (load "myfunc") (c:myfunc))
…so that they behave like native commands. However, there's one function out of those 500 that just won't cooperate. The problem child:
(defun c:br () (load "br") (c:br))
This function is designed to insert a custom block. However, executing it produces no result until I load it a second time, after which it behaves normally. I'm using a workaround that involves an additional line in the file:
(defun c:brx () (load "br") (c:br))
…so that I can run the function initially by typing "brx," after which "br" does the job. But it still puzzles me why br is the only one that won't autoload initially.
Maybe it's something really simple that I'm overlooking. If anyone can point out what I'm doing wrong, please do.
Thanks!
Comments
-
It could be that a command with that name is already registered, I.e. BR is already an alias for Break. Generally, it’s a good idea to attempt to prevent command name clashes, especially if your sharing routines.
0 -
Like Its Alive I type short defun names to make sure they are not reserved words, a simple but quick check. You can redefine and undefine variable names but in this case BR think of another short name.
0 -
I get the general advice not to use "reserved words," but I also like to use intuitive mnemonics for my functions, so I'll probably stick with the brx workaround. And isn't the "br for break" simply a PGP file matter? I removed br from my PGP file decades ago.
0