How to create .lisp files and run them on mac? - macos

As can be seen on the picture TextEdit on mac gives only limited options of file extensions in which I can safe a file. Lisp not included.
Create .lisp files
https://www.tutorialspoint.com/lisp/lisp_environment.htm is describing everything step by step, but it says TextEditor on Mac can save .lisp files, which I wasn't able to do.
Load .lisp file
(load "filename.lisp") leads to error: file with such name doesn't exist

TextEditor on mac has limitations to how file can be saved (.txt, etc.). You can use any other editor, ex: TextWrangler, which allow you to write file extension. Or you can use editors specific for lisp, ex: Emacs (more massive)
It's possible that when you type (load "filename.lisp") it searches in some specific directory, where it's not present. So, to avoid this, you should type full path to the file you want to open. Ex: (load "/Users/macbook/Desktop/foldername/filename.lisp")

Related

mac default application for any unknown extension

I have a series of files that are all text files that i want to open with text editor (let's say Sublime).
The extensions on these files follow the pattern:
file.sff123
file.sff124
file.sff125
file.sff126
and so on...
Every time i go to open one of these files, the dialog pops up to select the default application for this file type, but since they all have varying extensions, i have to navigate and select the new file type each time. I literally have 1000s of these files and would like to be able to open all of them. Further, i want to be able to open any unknown file with something like Sublime by default. 99% of the time its a random text file... the 1% that it's not i'll "open with".
Is there a way to get Mac to recognize any unknown file extension and open it with an application of my choosing by default?
I am not sure if it is possible, but the following (untested) may help you, or someone else work out how to do it.
OSX uses UTIs (Uniform Type Identifiers) to categorise filetypes and map them to applications - and this works in conjunction with Launch Services to launch the appropriate application.
I don't have one of your .sffnnn files available, but I think you need to run mdls on one and see what kMDItemContentType is. You can do that like this in Terminal:
mdls -name kMDItemContentType somefile.sff123
I am hoping you get the same content type for all your .sffnnn files - if you don't, this approach won't work.
You then need to edit your LaunchServices.plist file which, I think, is in ~/Library/Preferences/com.apple.LaunchServices.plist and make an entry corresponding to the filetype you found above that maps to the sublime application. I suggest you look in there, or the system-wide version to see how entries look.
Once you get the hang of it, you may be able to do it from the command-line with a command like:
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=xxxType;LSHandlerRoleAll=xxx.yyy.sublime;}'

How to create a .vm (velocity template file) from command line in Windows?

How to create a .vm (velocity template file) from command line in Windows
Based on you comment I assume what you really mean is how to made file which by default opens with some specific program you have. Here is several thing to be taken into account:
To create .vm file from command line you can use this question
By default windows doesn't show file extensions in explorer - so you won't actually see that it is .vm file in explorer. Reffer this guide to show file extensions.
There is such thing as file associations - e.g. default program to be use when you open file (for example double click). Also this affect icon shown for the file in explorer.
So to summarize - file created from command line(using method from referred question) have .vm extension. You don't see this cause your windows settings doesn't show extensions. You assume it is text file cause notepad++ icon shown for it as well as it opens with notepad++. That's a wrong assumption - simple you have notepad++ associated to open .vm files. If you want to use different program - you need either:
Change file associations (see link above).
Use open with option to open file with another program (right click menu option)
Use Open function from inside your program.

Changing default program for a file type (workaround)

I would like to specify that images of a certain type (for example, .png) open by default in a program I've written when the file is contained in a certain directory. I've seen by searching (Change Default Program for a specific folder) that this is not possible on Windows 7 or 8.
I am saving these images in this directory myself, so I have some leeway with how I name the files. For example, I could change the filename a bit... perhaps to be example.myprog.png or something similar. Is there a way to set it up so files that match this filename pattern get opened, while other .pngs (in other directories) still open in the default viewer?
I don't really want to name these PNG images example.myprog (i.e., fully change the extension), because when the user is browsing the directory in Windows Explorer, I would like the thumbnail images to still show up. Also, users will be eventually transferring these images to their own machines, where they'll want to use standard image viewers to look at them.
If this is not possible, does anyone have another suggestion for how to tackle this problem?
As you are mentioning that files should be opened in a program that you have written, try to change the code of your program to read files from the specific folder. So, by opening your program from anywhere in your pc, you should be able to open files from specified folder.

BBEdit is not recognizing ctags' tags file

I'm trying to get BBEdit to recognize my ctags file for a Rails project. I've tried generating it both with ctags-exuberant directly and with the bbedit --maketags command. While the tags I generate work perfectly in Vim, no such luck in BBEdit. No error messages or anything, just no symbols trigger completion or allow me to jump.
I've tried moving the tags file into the project directory, no luck. I've tried generating one lower down in my hierarchy (my models folder) and jumping between model classes, no luck.
Any ideas?
In case anyone else comes upon this question like I did, here's the answer from BBEdit support. In short, if you're using OSX Fuse, do this in Terminal:
defaults write com.barebones.bbedit DisableCtagsScanOnRemoteVolumes -bool NO
Full answer from BBEdit support:
Cribbing from the "Expert Preferences" page of the Help book (Help -> BBEdit Help):
====
** Miscellaneous **
[...]
When editing files that are on remote file servers (AFP, NFS,
SMB, etc), BBEdit will not look for directory-relative tags
files or settings files. This is a particular performance win
when the file is located on a volume mounted via MacFUSE/SSH or
similar, or if the file server is over a slow or high-latency link.
To enable scanning for tags or settings files on remote volumes,
use these [ Terminal commands ] separately or together:
defaults write com.barebones.bbedit DisableCtagsScanOnRemoteVolumes -bool NO
defaults write com.barebones.bbedit DisableSettingsScanOnRemoteVolumes -bool NO
====
Please note that if your only need is for ctags, you need apply only the first option ("DisableCtagsScanOnRemoteVolumes").
From the BBEdit manual (pages 302-304):
Using ctags
BBEdit allows you to generate and use tags files as text completion
sources, and will recognize any tags files associated with your
documents.
You may place tags files generated via ‘bbedit --maketags’ in the
Completion Sources folder of BBEdit’s application support folder (see
page 32) for use as text completion sources.
[...]
Tag Files as Completion Sources
You can now add tags files to specific locations to make symbols
available as completion data sources when editing in desired
languages. In particular:
When you build a (coded) language module, if you place a file named “tags” in the language module’s “Resources” directory, BBEdit will
use those tags as completion sources.
You can generate a tags file (using exuberant ctags or “bbedit --maketags”) and place the resulting file in Application Support/BBEdit/Completion Data/ /, where “
name>” is the name of the language as it appears in the list of
installed languages (or on the Languages popup menu).
So, for example, if you were to generate a tags file for the 10.6 SDK
so that you could add completion data when editing Objective-C files,
the file would go in Application Support/ BBEdit/Completion
Data/Objective-C/. Tags files can be given any appropriate name, so
you can have multiple tags files for a single language, and they will
all be examined when generating completions.
And the Completion Data section on p32:
Completion Data
This folder does not exist by default, but you may create it. The
Completion Data folder contains tags files (or aliases to tags files)
which can provide additional text completions for editing documents in
the corresponding languages. These tags files should be in the format
generated by ‘bbedit --maketags’, and must be placed in subfolders
corresponding to their languages.
Each subfolder should have the exact name of its language as that
language appears in the list of installed languages (or on the
Languages popup menu).
For example, the subfolder containing a Python tags file must be named
“Python”, and the subfolder containing a tags file for ANSI C must be
named “ANSI C”.

Redirect default program to another program when a file opens in Windows OS

This is only under windows env.
As I know windows os identifies associated application of a particular file by file extension.
Like wise each file (binary) starting with corresponding symbols ("starting symbols"). For an example .JPG starts with ÿØÿà. Let say I open this .JPG file in a Hex editor or a Text editor and then I change that starting symbols into another file type. for an example I can change ÿØÿà to .Eߣ (.mkv). So when I double click on the .JPG the Windows Photo Viewer says there are some errors or similar message. So I need to get some information about the application that tries to open that kind of a file. If I can, I need to open that file using the application that associated with "starting symbols".
Briefly when I open .JPG I need to open a default video player .mkv files. But It may not work for this example. Because I changed only the "starting symbols" of my .JPG.
Please give me any idea to do this.
Thanks!
When you encrypt the file, give it a new extension. e.g. Picture.jpg becomes Picture.encrypted-jpg. You then register as the handler for encrypted-jpg, decrypt the file, then launch the normal jpg handler.
When the shell is asked to perform a verb on a file, the shell does not use the contents of the file to determine which app to pass it to. The file extension is what determines how the file will be treated.
You wish to use the contents of the file to influence which app processes a shell verb. In order to do so you would need to create a launcher app that reads the file header and then decides which app to pass the file on to. You would assign your launcher app as the handler app for all file extensions that you were interested in.
Although you could do this, it would be much easier just to set the file extension appropriately.
The proper way to do this sort of thing is to replace the files with reparse points.
The downside is that this involves writing a file system filter driver, i.e., an operating system extension, which is a whole level of trouble above and beyond ordinary application programming. (Since Windows already does file encryption, I doubt it would be worth the effort.)

Resources