To define loc_XXXXXX as a function you should use P. This is used to create a function where your cursor at. In some cases you'll need to undefine the current analysis done by IDA on a specific place and then redefine it as code. You can do it by pressing U and then C. Finally, by using ALT+P you can edit an existing function.
Keep in mind that creating and editing functions might cause with unwanted side-effects, so be careful with that.
To define
loc_XXXXXX
as a function you should use P. This is used to create a function where your cursor at. In some cases you'll need to undefine the current analysis done by IDA on a specific place and then redefine it as code. You can do it by pressing U and then C. Finally, by using ALT+P you can edit an existing function.Keep in mind that creating and editing functions might cause with unwanted side-effects, so be careful with that.
For more shortcuts, see the Quick Reference Sheet by Hex-Rays.